Help to store in Ms Access

V

Vinay Patel

hi All

Q1.
i want to store string like

" vinay's home " in access database using vb.net

but my query get dropped because of " ' " in string input

and it become

Qry="Insert into info values('vinay's home')

i got error in this case so any one knows

how can i resolve it ??


Q2
is there any way to create store procedure for Access database if yes
than how ?


Waiting for Reply

Thanks in advance

With Regards

Vinay Patel
 
R

Rad [Visual C# MVP]

hi All

Q1.
i want to store string like

" vinay's home " in access database using vb.net

but my query get dropped because of " ' " in string input

and it become

Qry="Insert into info values('vinay's home')

i got error in this case so any one knows

how can i resolve it ??

Q2
is there any way to create store procedure for Access database if yes
than how ?

Waiting for Reply

Thanks in advance

With Regards

Vinay Patel

Two options
1) Use parameterized queries (OleDB commands using OleDbParameters)
2) Replace all ' with '' using the String.Replace method
 
S

sloan

Open up the database.

Add a new Query. Change the type to "Updateable" I think it is.

Start out with something simple like

qryCustomerUpdate

Maybe supply 2 parameters

pCustomerID , pLastName

and the query is

Update Customer Set LastName = pLastName where CustomerID = pCustomerID

the last time i did this (circa 2001 I think) i used to put 'p' s in for
parameters, to increase readability, since there is no @variableName like in
sql server.

It's something along those lines.
 

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