2013-03-19 32 views
0

我在Microsoft Office Access中創建了一個數據庫。在form1.cs我添加了一個DataGridView與創建的數據庫的來源。在tableDataSet.xsd/tabelAdapter我創建了一個新的查詢與3個參數,我用這個數據插入數據庫(Name, Password, Age)。我如何使用這個查詢與3個不同的textbox 3參數?如何在C#(而不是web)中使用查詢?

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) 
     { 

     } 
    } 
} 

回答

相關問題