执行到SqlDataReader myread=myCmd1.ExecuteReader(); 这句的时候出现d425b4426704c181c1515ba152' 语法错
代码段protectedvoidButton1_Click(objectsender,EventArgse){stringstrConnection="Server=Lo...
代码段
protected void Button1_Click(object sender, EventArgs e)
{
string strConnection = "Server=LocalHost;Integrated Security=SSPI;Database=FrienDevLog";
myConn = new SqlConnection(strConnection);
string user;
user = Label2.Text;
myConn.Open();
string mySel = "SELECT Body from Log where UserId="+user+"";
SqlCommand myCmd1 = new SqlCommand(mySel, myConn);
SqlDataReader myread=myCmd1.ExecuteReader();
//Label3.Text = myread.GetString(1);
myConn.Close();
} 展开
protected void Button1_Click(object sender, EventArgs e)
{
string strConnection = "Server=LocalHost;Integrated Security=SSPI;Database=FrienDevLog";
myConn = new SqlConnection(strConnection);
string user;
user = Label2.Text;
myConn.Open();
string mySel = "SELECT Body from Log where UserId="+user+"";
SqlCommand myCmd1 = new SqlCommand(mySel, myConn);
SqlDataReader myread=myCmd1.ExecuteReader();
//Label3.Text = myread.GetString(1);
myConn.Close();
} 展开
展开全部
string mySel = "SELECT Body from Log where UserId="+user+"";
改成
string mySel = "SELECT Body from Log where UserId='"+user+"'";
试试
改成
string mySel = "SELECT Body from Log where UserId='"+user+"'";
试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是不是你的sql语句有语法错误
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询