数据库连接小疑点

数据库连接小问题
vb.net中
VB.NET code
 SqlConnection1.Open()
        SqlCommand1.Connection = SqlConnection1
        SqlCommand1.CommandText = "select count(*) from 程序填空  where 填空题编号=" & TextBox1.Text
        SqlCommand1.ExecuteScalar()

        SqlCommand2.Connection = SqlConnection1
        SqlCommand2.CommandText = "select count(*) from 判断题  where 判断题编号=" & TextBox2.Text
        SqlCommand2.ExecuteScalar()

        If SqlCommand1.ExecuteScalar().ToString = 1 & SqlCommand1.ExecuteScalar().ToString = 1 Then
            TextBox1.Text = a
            TextBox2.Text = b
            MessageBox.Show("抽题成功!!")
        Else
            MessageBox.Show("请重新出题  !")

        End If

        SqlConnection1.Close()

第 1 行: '=' 附近有语法错误。???????

------解决方案--------------------
对 不应该这样写,
SqlCommand1.CommandText = "select count(*) from 程序填空 where 填空题编号= '"+TextBox1.Text+"'"

应该把Textbox2.Text写在字符串里面

------解决方案--------------------
顶.......
------解决方案--------------------
探讨
对 不应该这样写,
SqlCommand1.CommandText = "select count(*) from 程序填空 where 填空题编号= '"+TextBox1.Text+"'"

应该把Textbox2.Text写在字符串里面

------解决方案--------------------
"select count(*) from 程序填空 where 填空题编号=" & TextBox1.Text
加单引号
SqlCommand1.CommandText = "select count(*) from 程序填空 where 填空题编号= "'"+TextBox1.Text+"'"

------解决方案--------------------
探讨
"select count(*) from 程序填空 where 填空题编号=" & TextBox1.Text
加单引号
SqlCommand1.CommandText = "select count(*) from 程序填空 where 填空题编号= "'"+TextBox1.Text+"'"

------解决方案--------------------

这个就坟了吧.
------解决方案--------------------
怎么都纠结单引号

If SqlCommand1.ExecuteScalar()= 1 AndAlso SqlCommand1.ExecuteScalar()= 1 Then
------解决方案--------------------
顶2楼的,sql语句是一种很脆弱的语句。很容易错的!
------解决方案--------------------
探讨
对 不应该这样写,
SqlCommand1.CommandText = "select count(*) from 程序填空 where 填空题编号= '"+TextBox1.Text+"'"

应该把Textbox2.Text写在字符串里面