在vb.net中
con.open()
sqlstring = "select * from zdjmtj where observtime=07060100"
Dim mycmd As New SqlCommand(sqlstring, con)
t = mycmd.Parameters.Count
为什么t总是为0?
...全文
1528打赏收藏
为什么mycmd.Parameters.Count总是为0?
在vb.net中 con.open() sqlstring = "select * from zdjmtj where observtime=07060100" Dim mycmd As New SqlCommand(sqlstring, con) t = mycmd.Parameters.Count 为什么t总是为0?
For j = 0 To t - 1
If mycmd.Parameters.Item(j) Is "1" And InStr(allstr, (mycmd.Parameters(j).ParameterName)) > 0 Then
jj += 1
str1 = str1 & " " & mycmd.Parameters(j).ToString & " "
ElseIf mycmd.Parameters.Item(j) Is "2" And InStr(allstr, (mycmd.Parameters(j).ParameterName)) > 0 Then
nn += 1
str2 = str2 & " " & mycmd.Parameters(j).ToString & " "
ElseIf mycmd.Parameters.Item(j) Is "3" And InStr(allstr, (mycmd.Parameters(j).ParameterName)) > 0 Then
zz += 1
str3 = str3 & " " & mycmd.Parameters(j).ToString & " "
End If
Next
我的原意是把列值和表的列名取出来,不知道用什么方法?请大家指点。谢谢!