Data Type Help

G

Guest

I am wirting a VB program, and use the following code in a form load event

Dim prm38 As OleDb.OleDbParameter = _
dap3.UpdateCommand.Parameters.Add("@total_points", _
System.Data.OleDb.OleDbType.Integer, "total_points")
prm38.SourceColumn = "total_points"

And Receive the following Error:

An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Cast from string "total_points" to type 'Integer' is not valid.

I am using an Access database

field total_points is a number field type integer

Help.
 
C

chen qi

you are right:

dr1(cboweek.text) = value; // change value
da1.update(); // save the change to database by
DataAdapter
ds1.acceptChanges(); // if update() success, mark the DataSet

ps:it's only a simple example. for performance you'd better do some
odify. -_-b

Tom Nowak said:
This worked. Thank you for your help.

I have another question that maybe you can help me with.
I have 18 fields in a table. Name and 1-17. When a user chooses a number
in a combo box on a form (1-17), I want to save a value to the field in the
database. So, if a user chooses 3, I want a value saved in field 3. I can
do:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top