关于'form' 附近有语法错误(在线等待)
请各位大虾赐教,到底咋错了,应该怎么改,谢谢啊~~~
错误是:第 1 行: 'form ' 附近有语法错误。
行 22: SqlDataReader reader;
行 23: conn.Open();
行 24: reader = cmd.ExecuteReader(); //错误标示在这一行
行 25: while (reader.Read())
代码如下:
string strConnection, strSql;
strConnection = "data source=QW;user id=sa;password=517123;database=wuqiang ";
strSql = "select * form messageBorad ";
SqlConnection conn = new SqlConnection(strConnection);
SqlCommand cmd = new SqlCommand(strSql, conn);
SqlDataReader reader;
conn.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
Label1.Text = reader.GetString(0);
Label2.Text = reader.GetString(1);
Label3.Text = reader.GetString(2);
Label4.Text = reader.GetString(3);
Label5.Text = reader.GetString(4);
}
reader.Close();
conn.Close();
------解决方案--------------------select * form messageBorad -> select * from messageBorad