Hi, if I connected access data base to vb form and I want to insert value of dropdown list(Items are yes and no) into the data base (field is type of Yes/No) what will be the insert statement?!

Recommended Answers

All 9 Replies

post your code...

cmcontact.CommandText = ("insert into table1_local(y/n) values (" + Me.DropDownList1.SelectedValue + ");")

I got syntax error.. I tried to put the drop down list values 1 and 0 also I tried to put them true and false both times I got error

you have dropdownlist with value Yes and No. you want to insert selected value in dropdownlist to db.

cmcontact.CommandText = "INSERT INTO TableName(ColumnName) VALUES('" & Me.DropDownList1.SelectedValue & "')"

What kind of error was come?

I got :
Syntax Error in Insert statement

I got :
Syntax Error in Insert statement

are you have tried my code in previous post??

Yes! same code

what its your column name?

I found the solution!
my column name was y/n
this contains special char (/) when i removed this char it worked
thanx any way

oh, great.
Don't forget to mark this thread solved.
Happy coding friend :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.