Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Sat, 28 Jun 2008 16:36:19 +0200,    group: microsoft.public.dotnet.languages.vb.data        back       


Problem With Vista VB9 and ODBC   
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: Sat, 28 Jun 2008 16:36:19 +0200   author:   Tomas Andersson

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

Re: Problem With Vista VB9 and ODBC   
On Wed, 2 Jul 2008 14:26:29 +0200, "Tomas Andersson"  wrote:

¤ 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?

Do you know on which line the error occurs? Is the Pervasive/Btrieve ODBC driver installed on the
Vista machine?


Paul
~~~~
Microsoft MVP (Visual Basic)
date: Thu, 03 Jul 2008 10:37:35 -0500   author:   Paul Clement

Re: Problem With Vista VB9 and ODBC   
The Pervasive/Btrieve ODBC driver is installed and connection works.
I installed VB 2008 Express Edition on the Vista machine and ran the project 
from code. and it works.
Then I built the project(on the vista machine) and the same problem ocurrs 
System.NullReferenceException:


"Paul Clement"  skrev i 
meddelandet news:9fsp64p1hp8dbsq57l5he8n9mlrcduu2u4@4ax.com...
> On Wed, 2 Jul 2008 14:26:29 +0200, "Tomas Andersson" 
>  wrote:
>
> ¤ 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?
>
> Do you know on which line the error occurs? Is the Pervasive/Btrieve ODBC 
> driver installed on the
> Vista machine?
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)
date: Fri, 4 Jul 2008 11:13:21 +0200   author:   Tomas Andersson

Re: Problem With Vista VB9 and ODBC   
On Fri, 4 Jul 2008 11:13:21 +0200, "Tomas Andersson"  wrote:

¤ The Pervasive/Btrieve ODBC driver is installed and connection works.
¤ I installed VB 2008 Express Edition on the Vista machine and ran the project 
¤ from code. and it works.
¤ Then I built the project(on the vista machine) and the same problem ocurrs 
¤ System.NullReferenceException:
¤ 

It almost sounds like the problem is related to a column containing a Null value. This could raise
an exception if you're attempting to assign this value to a variable - specifically a string
variable.


Paul
~~~~
Microsoft MVP (Visual Basic)
date: Mon, 07 Jul 2008 12:40:22 -0500   author:   Paul Clement

Re: Problem With Vista VB9 and ODBC   
I solved the problem.

And here it is
Console.WriteLine(Reader("D1021_Benaemning").PadLeft(9) & _
ControlChars.Tab & Reader("D1001_Artikelkod"))

when i removed the console.writeLine part the functions worked on Vista but 
it seems strange. Can it be the part .PadLeft(9) that is causing the error
date: Fri, 12 Sep 2008 08:45:30 +0200   author:   Tomas Andersson

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us