C#提示','附近有语法错误,急!!!在线等!!!!
stringconn="DataSource=.;InitialCatalog=电子书架;IntegratedSecurity=True";SqlConnectionco...
string conn = "Data Source=.;Initial Catalog=电子书架;Integrated Security=True";
SqlConnection connection = new SqlConnection(conn);
string sql=String .Format ("select 图书编号,书名,作者,出版社,类型,年份,图书简介 from 图书基本信息 where 书名={0}",textBox2.Text );
try
{
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
SqlDataReader dt = command.ExecuteReader();
textBox1.Text = (dt[0].ToString());
textBox2.Text = (dt[1].ToString());
textBox3.Text = (dt[2].ToString());
textBox4.Text = (dt[3].ToString());
textBox5.Text = (dt[4].ToString());
textBox6.Text = (dt[5].ToString());
textBox7.Text = (dt[6].ToString());
} 展开
SqlConnection connection = new SqlConnection(conn);
string sql=String .Format ("select 图书编号,书名,作者,出版社,类型,年份,图书简介 from 图书基本信息 where 书名={0}",textBox2.Text );
try
{
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
SqlDataReader dt = command.ExecuteReader();
textBox1.Text = (dt[0].ToString());
textBox2.Text = (dt[1].ToString());
textBox3.Text = (dt[2].ToString());
textBox4.Text = (dt[3].ToString());
textBox5.Text = (dt[4].ToString());
textBox6.Text = (dt[5].ToString());
textBox7.Text = (dt[6].ToString());
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询