Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.net & MSSQL error message

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
US
I have a very simple program that I'm trying to convert from Access tables to MSQL. But when I do I get the following error and this line is highlighted in the code.

Thi this is the error message whent he program is being tesed - -
An unhandled exception of type 'System.Data.SqlClient.SqlException' occured in system.data.dll. Additional informtuion:System error.

This line is highlighted - -
SqlDataAdapter1.Fill(DataSet11) 'flll dataset1 when form opens

During the creation of the Data Adapter, a message states - The wizard can not automatically create queries for updating the database becausee your query does not include some primary key columns. Do you wish to add the primary key columns to your query? If I click on Yes or No the program still generates the errror during debug. I'm not sure why in MSQL it asks for a primary key, in an application that uses access it does ask.


Below is the complete code, as for now.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DataSet11.Clear()
SqlDataAdapter1.Fill(DataSet11) 'flll dataset1 when form opens

End Sub

Private Sub SqlDataAdapter1_RowUpdated(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlRowUpdatedEventArgs) Handles SqlDataAdapter1.RowUpdated

End Sub

Private Sub SqlConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlInfoMessageEventArgs) Handles SqlConnection1.InfoMessage

End Sub
End Class
 
Where is the relevant info on SqlDataAdapter1 and SqlCOnnection1? Are they public to the form?

IMO you would be better off getting rid of these objects when you aren't using them, but regardless we need to see how they are instantiated, what commands are set to, etc.. etc...

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Also try the vb.net forum, as this is really a vb6 forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top