weird problm on odbccommand parameter.

  • Thread starter Thread starter Tracey
  • Start date Start date
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!
 
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
 
Back
Top