我在 microsoft office access 中创建了一个数据库。在form1.cs
我添加了一个DataGridView
来自创建的数据库的源。在tableDataSet.xsd/tabelAdapter
我创建了一个带有 3 个参数的新查询,用于在数据库中插入数据( Name, Password, Age)
。我如何将这个查询与来自 3 个不同的 3 个参数一起使用textbox
?
PS:我只使用 Windows 窗体应用程序,没有 asp.net 等。
代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace lucian
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'jucatoriDataSet.jucator' table. You can move, or remove it, as needed.
this.jucatorTableAdapter.Fill(this.jucatoriDataSet.jucator);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void adaugareToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.jucatorTableAdapter.Fill(this.jucatoriDataSet.jucator);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}