> Probably
MyCommand.Parameters("@Sport").value = sport.text
That again gives me an Object reference not set to an instance of an
object error.
Here is the subroutine I'm using with the click event and such (this
is part of a datagrid display, as for the BindGrid() reference). I'm
able to view the page that displays the datagrid and textboxes/button,
but get the error when i try to add something to the 'sport' and
'articleheader' textboxes:
Sub AddArticle_Click(Sender As Object, E As EventArgs)
If (Page.IsValid)
Dim DS As DataSet
Dim MyCommand As SqlCommand
Dim InsertCmd As String = "insert into tblArticles
(sport,articleheader) values (@Sport, @articleheader)"
MyCommand.Parameters.Add(New SqlParameter("@Sport",
SqlDbType.VarChar, 50))
MyCommand.Parameters("@Sport").value = sport.Text
MyCommand.Parameters.Add(New SqlParameter("@articleheader",
SqlDbType.nVarChar, 255))
MyCommand.Parameters("@articleheader").value =
articleheader.Text
MyCommand.Connection.Open()
' testing from aspalliance stuff
myCommand.ExecuteNonQuery()
MyCommand.Connection.Close()
End If
BindGrid()
End Sub