Refresh datagrid ODBC

Puiu

Well-known member
Joined
Oct 6, 2004
Messages
90
Hello there! I have the following code in an ASP Project:

Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click

MyConnection = New OdbcConnection(MyConnString)
MyCommand = New OdbcCommand("insert into names values( , Ioana, Maria)", MyConnection)

MyConnection.Open()
dgrAllNames.DataSource = MyCommand.ExecuteReader(CommandBehavior.CloseConnection Or CommandBehavior.SingleResult)

dgrAllNames.DataBind()

MyConnection.Close()

End Sub

--------------------------------------------------------------------------
dgrAllNames = datagrid
When i hit the button the datagrid dissapears. Why? The record is added because when i start again the project i see the record added (so the connection string is ok also). But the datagrid dissapears. Also i get NO error!!
What should i do?? thank you


And by the way what should i use: ADODB or ODBC to work with mySQL in ASP .NET or VB .NET ??
 
From what i can see, your executing a datareader with an insert command - this will not return any records hence no records in the datagrid
 
Back
Top