N
Nathan
Hi,
I'm doing a database app using MS Access and OleDb adapters, and I'm having
trouble with getting strings containing apostrophes in and out of the
database. I read through a thread below with subject "Apostrophys in text
field - SQL Server as backend" and now I'm trying to figure out how to make
it work in my case, particularly the input from William Ryan.
What I have are a couple fields to be inserted directly as a new row, and
I've been doing this with something like the following (because I'm still
new to this):
INSERT INTO MyTable (Field1, Field2) VALUES ('" & String1 & ", " & String2 &
"')"
String1 and String2 are strings with apostrophes, such as "Bob's Auto Shop."
So I want to do this:
INSERT INTO MyTable (Field1, Field2) VALUES (@String1, @String2)
How do I assign those paramaters before doing the insert? So far I've only
tried:
InsertCmd.Paramaters.Add("@String1", String1)
But I get an error saying @String1 has no default value. The MSDN
documentation is of no help at all--I hardly understand it. I'd appreciate
some help from someone who can speak in layman's terms.
Thanks in advance,
Nathan
I'm doing a database app using MS Access and OleDb adapters, and I'm having
trouble with getting strings containing apostrophes in and out of the
database. I read through a thread below with subject "Apostrophys in text
field - SQL Server as backend" and now I'm trying to figure out how to make
it work in my case, particularly the input from William Ryan.
What I have are a couple fields to be inserted directly as a new row, and
I've been doing this with something like the following (because I'm still
new to this):
INSERT INTO MyTable (Field1, Field2) VALUES ('" & String1 & ", " & String2 &
"')"
String1 and String2 are strings with apostrophes, such as "Bob's Auto Shop."
So I want to do this:
INSERT INTO MyTable (Field1, Field2) VALUES (@String1, @String2)
How do I assign those paramaters before doing the insert? So far I've only
tried:
InsertCmd.Paramaters.Add("@String1", String1)
But I get an error saying @String1 has no default value. The MSDN
documentation is of no help at all--I hardly understand it. I'd appreciate
some help from someone who can speak in layman's terms.
Thanks in advance,
Nathan