|
|
|
date: Sat, 28 Jun 2008 16:36:19 +0200,
group: microsoft.public.dotnet.languages.vb.data
back
Re: Problem With Vista VB9 and ODBC
Thomas, Well, without knowing what kind of database you're accessing it
would be hard to make meaningful suggestions. It might also help to describe
what kind, type, message, number, version, error is in play.
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
"Tomas Andersson" wrote in message
news:#wlgwwS2IHA.5472@TK2MSFTNGP06.phx.gbl...
> So the problem is that i have an application written in VB9 that works on
> XP but not on VISTA
> This works on XP
>
> Public ConnString As String = "dsn=FILPYSKARP"
> CmdString = "SELECT * FROM PULAGER WHERE D1021_Benaemning = '" +
> CStr(designation) + "'"
> Dim structureExists As Boolean
> structureExists = db(CmdString)
> Public Function db(ByVal CmdString As String) As Boolean
> Dim Conn As OdbcConnection
> Dim Reader As OdbcDataReader
> Conn = New OdbcConnection(ConnString)
> Try
> Conn.Open()
> Dim Cmd As New OdbcCommand(CmdString, Conn)
> Reader = Cmd.ExecuteReader()
> While (Reader.Read())
> If Reader("D1021_Benaemning").PadLeft(9) <> "" Then
>
> ArticleNumber = Reader("D1001_Artikelkod")
> MainNumber = Reader("D1001_Artikelkod")
>
> Return True
> Else
> ArticleNumber = Nothing
> Return False
> End If
> End While
> Catch ex As Exception
> Console.WriteLine("Error: {0}", ex)
> Finally
> Conn.Close()
> End Try
> End Function
>
> If anyone has any suggeston on getting rid of the dsn im all ears.
> but my main consern is that this doesnt vork on vista
>
>
date: Mon, 30 Jun 2008 17:03:21 -0700
author: William Vaughn [MVP]
Re: Problem With Vista VB9 and ODBC
Ok sorry,
the code below is used to connect via dsn in xp
The syntax is SQL
The DB is Pervasive Betrive 9 running on a debian server
this is what the exeption message says
Dont expect you to know swedish, but something about that the
objectreference not being mentioned for an instance of an object by
PROGRAMNAME.OdbcProvider.db(String CmdString)
System.NullReferenceException: Objektreferensen har inte angetts till en
instans av ett objekt.
vid Strukturprogram.OdbcProvider.db(String CmdString)
does this make any sense?
"William Vaughn [MVP]" skrev i meddelandet
news:FB1377FB-2E2B-40B3-B5CF-D6E306A599C3@microsoft.com...
> Thomas, Well, without knowing what kind of database you're accessing it
> would be hard to make meaningful suggestions. It might also help to
> describe what kind, type, message, number, version, error is in play.
>
> --
> __________________________________________________________________________
> William R. Vaughn
> President and Founder Beta V Corporation
> Author, Mentor, Dad, Grandpa
> Microsoft MVP
> (425) 556-9205 (Pacific time)
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> ____________________________________________________________________________________________
>
> "Tomas Andersson" wrote in message
> news:#wlgwwS2IHA.5472@TK2MSFTNGP06.phx.gbl...
>> So the problem is that i have an application written in VB9 that works on
>> XP but not on VISTA
>> This works on XP
>>
>> Public ConnString As String = "dsn=FILPYSKARP"
>> CmdString = "SELECT * FROM PULAGER WHERE D1021_Benaemning = '" +
>> CStr(designation) + "'"
>> Dim structureExists As Boolean
>> structureExists = db(CmdString)
>> Public Function db(ByVal CmdString As String) As Boolean
>> Dim Conn As OdbcConnection
>> Dim Reader As OdbcDataReader
>> Conn = New OdbcConnection(ConnString)
>> Try
>> Conn.Open()
>> Dim Cmd As New OdbcCommand(CmdString, Conn)
>> Reader = Cmd.ExecuteReader()
>> While (Reader.Read())
>> If Reader("D1021_Benaemning").PadLeft(9) <> "" Then
>>
>> ArticleNumber = Reader("D1001_Artikelkod")
>> MainNumber = Reader("D1001_Artikelkod")
>>
>> Return True
>> Else
>> ArticleNumber = Nothing
>> Return False
>> End If
>> End While
>> Catch ex As Exception
>> Console.WriteLine("Error: {0}", ex)
>> Finally
>> Conn.Close()
>> End Try
>> End Function
>>
>> If anyone has any suggeston on getting rid of the dsn im all ears.
>> but my main consern is that this doesnt vork on vista
>>
>>
date: Wed, 2 Jul 2008 14:26:29 +0200
author: Tomas Andersson
|
|