weird problm on odbccommand parameter.

T

Tracey

There's some problem in my parameters.add statement, but
I just don't know where. Can someone tell me ?

I tried to change the STR =? to STR = 'Australia', my
program worked.(There is a lot of tuples with country
= 'Australia' in the table.)

But the STR = ? did not work. I guess there might be
problems on the ODBCParameter part. But I don't know
where.

Dim MyConString As String = "DRIVER={MySQL ODBC 3.51
Driver};SERVER=localhost;DATABASE=litlinker;
UID=;PASSWORD=; OPTION=3"

Dim MyConnection1 As New OdbcConnection(MyConString)
Dim cmdStr as string
cmdStr = "SELECT Name, Country FROM Tab1 Join Tab2 on
Tab1.Name = Tab2.Name Where Country = 'Australia'"
Dim cmd As New OdbcCommand(cmdstr, MyConnection1)

cmd.Parameters.Add("CountryName", OdbcType.Char, 200)
Dim strCountry as string = 'Australia'
cmd.Parameters("CountryName").Value = StrCountry

Thanks a lot!
 
H

Herfried K. Wagner [MVP]

Hello,

Tracey said:
There's some problem in my parameters.add statement, but
I just don't know where. Can someone tell me ?

I tried to change the STR =? to STR = 'Australia', my
program worked.(There is a lot of tuples with country
= 'Australia' in the table.)

Notice that you will have a better chance to get an answer if you post the
question to the ADO.NET newsgroup:

news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Web interface:

http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.adonet
 

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