C# WinFormApp SuperGridControl中的保存按钮
我试图创建一个按钮,将数据保存到数据库。将在SuperGridControl中编辑或引入新数据。我完全不知道怎么做。有什么建议吗C# WinFormApp SuperGridControl中的保存按钮,c#,winforms,dataset,C#,Winforms,Dataset,我试图创建一个按钮,将数据保存到数据库。将在SuperGridControl中编辑或引入新数据。我完全不知道怎么做。有什么建议吗 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyFirstWinForApp {
public partial class Users : Form
{
public Users()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'testDataSet.GrupyUzytkownikow' table. You can move, or remove it, as needed.
this.grupyUzytkownikowTableAdapter.Fill(this.testDataSet.GrupyUzytkownikow);
// TODO: This line of code loads data into the 'testDataSet.Uzytkownicy' table. You can move, or remove it, as needed.
this.uzytkownicyTableAdapter.Fill(this.testDataSet.Uzytkownicy);
}
private void button1_Click(object sender, EventArgs e)
{
try
{
!!!!!!!!!!!!!!!!!!!!!
MessageBox.Show("Dane zapisane", "Zapisano", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
} }
在
按钮上单击事件,您需要检查以下内容
进行检查以验证网格是否为空,将新数据绑定到
它李>
如果网格
不是空的,并且有一些数据,则需要
通过比较数据库中的数据排除重复数据
dataset/datatable
中的数据,并添加唯一的数据
在网格内