
August 18th, 2006, 11:59 AM
|
|
Registered User
|
|
Join Date: Jul 2006
Posts: 13
Time spent in forums: 7 h 32 m 18 sec
Reputation Power: 0
|
|
Datagrid Parameter
I am trying to create a form using a datagrid that will change the datagrid display when a user enters a numeric equivalent for the month. The code I have so far is this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cmd As New SqlCommand("SELECT Month FROM Orders WHERE Month = @param2", SqlConnection2)
cmd.Parameters.Add(New SqlParameter("@param2", SqlDbType.Int, 8)).Value = cbMonth.Text
Try
SqlConnection2.Open()
cmd = New SqlCommand(cmd.ToString, SqlConnection2)
DsBilling21.Clear()
SqlDataAdapter1.Fill(DsBilling21)
DataGrid1.DataSource = cmd.ExecuteReader()
Finally
SqlConnection2.Close()
End Try
End Sub
I am getting a system error on the DataGrid1.DataSource line.
Any help would be greatly appreciated!
Larry
|