C# 看不懂,public void frmBooksql(){//打开数据库SqlConnection mySqlConnection = new SqlConnection(Conn);mySqlConnection.Open();string sqlQuery = "SELECT * FROM Book";SqlCommand mySqlCommand = new SqlCommand(sqlQuery,mySqlConnection);mySqlComma
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 14:46:21
C# 看不懂,public void frmBooksql(){//打开数据库SqlConnection mySqlConnection = new SqlConnection(Conn);mySqlConnection.Open();string sqlQuery = "SELECT * FROM Book";SqlCommand mySqlCommand = new SqlCommand(sqlQuery,mySqlConnection);mySqlComma
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;
}
}
C# 看不懂,public void frmBooksql(){//打开数据库SqlConnection mySqlConnection = new SqlConnection(Conn);mySqlConnection.Open();string sqlQuery = "SELECT * FROM Book";SqlCommand mySqlCommand = new SqlCommand(sqlQuery,mySqlConnection);mySqlComma
这是数据库操作...不晓得你是哪里不懂的