問題
使用 SqlParameter 接收由DB取出的參數值
解決方法
Dim con As SqlConnection = ""
con.Open()
Dim com As SqlCommand = New SqlCommand()
com.Connection = con
com.CommandType = CommandType.StoredProcedure
com.CommandText = "MY_PROC"
com.Parameters.Add("NAME", SqlDbType.VarChar, 100).Value = "王曉明"
Dim mResult As SqlParameter = com.Parameters.Add("ID", SqlDbType.VarChar, 10)
mResult.Direction = ParameterDirection.Output
com.ExecuteNonQuery()
If com.Parameters("ID").Value <> "" Then
End If
con.Close()
沒有留言:
張貼留言