Send data from controls to database

masktoon

New member
Joined
Nov 20, 2004
Messages
4
Programming Experience
3-5
:) I am having a small problem

Whenever I try to enter the Data from a textbox or listbox wiht use of parameters in data-adapter, the 'build process ' is fine but, during execution it halts to give oledb exception.

I am using an Access Database. There are no errors in the code but only during execution.

please help
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
Ok, i wrote a program (for a class) that used Parameterized Quiries for an Access DB.
this is what it had:

VB.NET:
 DsCats1 as DataSet
 daCat as DataAdapter
 
 DsCats1.Clear()
 daCat.SelectCommand.Parameters("OwnerID").Value = lstCustomerID.Text
 daCat.Fill(DsCats1)

now what it's doing is: when the program loads, it lists all the Cat's owner names in a list box, then when the user clicks one of the names it selects only the Cat's associated with that owner (based on OwnerID) so in the Querie Builder when i made the dataset there, in the 'Criteria' column i put '=?' next to the OwnerID feild and that code up there is how to fill the dataset based on the Parameter which is what you're trying to accomplish.
 

masktoon

New member
Joined
Nov 20, 2004
Messages
4
Programming Experience
3-5
thanks a lot

but i am also having another problem . Whenever I tried to enter the date(eg.Date of birth) through a textbox, it gave the exception. the datatype of the column in Access DB is set to 'DateTime'
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
if isdate(lstCustomerID.Text) = true then

daCat.SelectCommand.Parameters("OwnerID").Value = "#" & lstCustomerID.Text & "#"

end if

the #'s around the denote a datetime value is used in a datetime field
 
Top Bottom