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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with MissingSchemaAction.AddWithKey

Status
Not open for further replies.

HRHK

Programmer
Jun 5, 2005
83
US
Hello,

This is related to my previous thread. I have a problem while filling
the dataset with schema information for just this one table 't_request'(it works on
all other tables though). If line da.MissingSchemaAction = MissingSchemaAction.AddWithKey
is commented out, it works. I don't know what's the problem with that line on that
particular table (t_request). The error during Fill with the above line still in is is:
'Object reference not set to an instance of an object.' I checked the myconnection & trans variable, they are working correctly.

Any suggestions how to fix this would be much appreciated. Thanks again.



strsql = "SELECT * FROM t_request WHERE request_id=" & m_requestID

Dim mycommand As New OdbcCommand(strsql, myConnection, trans)
Dim da As New OdbcDataAdapter(mycommand)

da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "t_request")
 
I dropped the table and re-created thinking there's something problem with the table, but it didn't help either.
Any suggestions?
 
I have to say I never heard of the missingaction thingie. What does it do?
does the table have a primary key?

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
If a column in a data source is identified as auto-incrementing, the FillSchema method, or the Fill method with a MissingSchemaAction of AddWithKey, creates a DataColumn with an AutoIncrement property set to true.

t_request table has primary key.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top