C# 看不懂,public void frmBooksql(){//打开数据库SqlConnection mySqlCo
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/08/12 18:48:03
C# 看不懂,
public void frmBooksql()
{
//打开数据库
SqlConnection mySqlConnection = new SqlConnection(Conn);
mySqlConnection.Open();
string sqlQuery = "SELECT * FROM Book";
SqlCommand mySqlCommand = new SqlCommand(sqlQuery,mySqlConnection);
mySqlCommand.ExecuteNonQuery();
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySqlCommand);
//填充数据库
DataSet myDs = new DataSet();
mySqlDataAdapter.Fill(myDs);
//关闭数据库
mySqlConnection.Close();
this.dgvBook.DataSource = myDs.Tables[0];
}
private void dgvBook_DataError(object sender,DataGridViewDataErrorEventArgs e)
{
if (e.Exception = null &&
e.Context == DataGridViewDataErrorContexts.Commit)
{
MessageBox.Show("CustomerID value must be unique.");
}
}
private int DoDelete(string paramNo)
{
int returnValue = 0;
BUBook myBUBook = new BUBook();
returnValue = myBUBook.BUDelete(paramNo);
return returnValue;
}
private void Search(string paramNo,string paramName,string paramTyre,string paramState)
{
BUBook myBUBook = new BUBook();
DataTable myDataTable = new DataTable();
myDataTable = myBUBook.BUSearch(paramNo,paramName,paramTyre,paramState);
this.dgvBook.DataSource = myDataTable;
}
private void CheckBike_Load(object sender,EventArgs e)
{
frmBooksql();
BUBook myBUBook = new BUBook();
DataTable myDt = new DataTable();
myDt = myBUBook.BUTyre();
this.cmbTyre.DataSource = myDt;
this.cmbTyre.DisplayMember = "Tyre";
this.cmbTyre.ValueMember = "Tyre";
this.cmbTyre.SelectedValue.ToString();
this.cmbTyre.Text = "";
}
private void btFind_Click(object sender,EventArgs e)
{
string paramNo = this.txtNo.Text.Trim();
string paramName = this.txtName.Text.Trim();
string paramTyre = this.cmbTyre.Text.ToString();
string paramState = this.cmbState.Text.ToString();
this.Search(paramNo,paramName,paramTyre,paramState);
}
private void bt1Home_Click(object sender,EventArgs e)
{
frmintroduction myfrmintroduction = new frmintroduction();
myfrmintroduction.Show();
this.Hide();
this.DialogResult = DialogResult.No;
}
}
public void frmBooksql()
{
//打开数据库
SqlConnection mySqlConnection = new SqlConnection(Conn);
mySqlConnection.Open();
string sqlQuery = "SELECT * FROM Book";
SqlCommand mySqlCommand = new SqlCommand(sqlQuery,mySqlConnection);
mySqlCommand.ExecuteNonQuery();
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySqlCommand);
//填充数据库
DataSet myDs = new DataSet();
mySqlDataAdapter.Fill(myDs);
//关闭数据库
mySqlConnection.Close();
this.dgvBook.DataSource = myDs.Tables[0];
}
private void dgvBook_DataError(object sender,DataGridViewDataErrorEventArgs e)
{
if (e.Exception = null &&
e.Context == DataGridViewDataErrorContexts.Commit)
{
MessageBox.Show("CustomerID value must be unique.");
}
}
private int DoDelete(string paramNo)
{
int returnValue = 0;
BUBook myBUBook = new BUBook();
returnValue = myBUBook.BUDelete(paramNo);
return returnValue;
}
private void Search(string paramNo,string paramName,string paramTyre,string paramState)
{
BUBook myBUBook = new BUBook();
DataTable myDataTable = new DataTable();
myDataTable = myBUBook.BUSearch(paramNo,paramName,paramTyre,paramState);
this.dgvBook.DataSource = myDataTable;
}
private void CheckBike_Load(object sender,EventArgs e)
{
frmBooksql();
BUBook myBUBook = new BUBook();
DataTable myDt = new DataTable();
myDt = myBUBook.BUTyre();
this.cmbTyre.DataSource = myDt;
this.cmbTyre.DisplayMember = "Tyre";
this.cmbTyre.ValueMember = "Tyre";
this.cmbTyre.SelectedValue.ToString();
this.cmbTyre.Text = "";
}
private void btFind_Click(object sender,EventArgs e)
{
string paramNo = this.txtNo.Text.Trim();
string paramName = this.txtName.Text.Trim();
string paramTyre = this.cmbTyre.Text.ToString();
string paramState = this.cmbState.Text.ToString();
this.Search(paramNo,paramName,paramTyre,paramState);
}
private void bt1Home_Click(object sender,EventArgs e)
{
frmintroduction myfrmintroduction = new frmintroduction();
myfrmintroduction.Show();
this.Hide();
this.DialogResult = DialogResult.No;
}
}
这是数据库操作...不晓得你是哪里不懂的
再问: 哪句都不懂啊。要下载什么东西有解释。初学者。看不懂。蛋疼回复
再问: 哪句都不懂啊。要下载什么东西有解释。初学者。看不懂。蛋疼回复
C# 看不懂,public void frmBooksql(){//打开数据库SqlConnection mySqlCo
#include class A { public:void print1() { cout
public static void main(String[] args) {
EPLAN 打开数据库时出错
public class SystemTest { public static void main(String[] a
public class Foo { public static void main(String[] args) {
public class Test { public static void main(String[] agrs) {
public class Test{ public static void main(String args[]){ i
public class TreeMapDemo { public static void main(String[]
java 九九乘法表public class s99{public static void main(String[]
C#类中的public和private区别
c# public ObservableCollection icons = new ObservableCollect