English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i connected the database with ado connection but i don't know how to:add, edit ,delete records to database through the vb .
also i need help in how to make some text box value as a parameter to a query?
plzzz i need some quick help or if u know any good link to a tutorial or any useful site ,i'll be so thankful

2006-09-17 23:44:09 · 3 answers · asked by oomx555 2 in Computers & Internet Programming & Design

3 answers

you can do the insert, update and delete in various ways..

First method
using a recordset

rs.open ("insert into table1 values ('"& text1.text &"', "& text2.text &")",connectionstring name)

the textbox values are being passed directly as parameters here. you need to to be careful while you put the values in quotations as shown
Note:-
for char values the it will be ' " & text1.text & " '
for numeric values it will be " & text2.text & "

similarly for update will be
rs.open ("update table1 set (field name1 = ' " & text1.text & " ', field name2 = " & text2.text & ") where field name0= " & textID.text & " ", con)

rs. open ("delete from table1 where field name0= " & textID.text & " ", con)

Second method is of using the command object
You have to declare the command object and its parameters as

Dim com1 as New command
Dim param1 as parameter
Dim param1 as parameter

then you need to specify the command object properties like connection, command type etc

for the parameters you got to specify direction, value etc

I'll show you the code tommorrow

2006-09-18 00:46:25 · answer #1 · answered by parul k 2 · 1 0

to give textbox value as parameter in a query
for example

you have created one table Emp(name,age)
now you want the records that is age>30
then you can write the query like
select name,age from Emp where age>30
or you want to only the particular age that is in the textbox means you can write like
select name,age from emp where age=text1.text

2006-09-18 00:13:48 · answer #2 · answered by Muthulakshmi L 1 · 0 0

This link might help you

http://www.google.co.uk/search?hl=en&q=visual+basic+%2Caccess+and+ado+connection&btnG=Google+Search&meta=

2006-09-17 23:55:30 · answer #3 · answered by Joe_Young 6 · 1 0

fedest.com, questions and answers