SQL OLEDB connection

From: Anna Sentyurin (a-ansent@microsoft.com)
Date: 03/29/03


From: "Anna Sentyurin" <a-ansent@microsoft.com>
Date: Fri, 28 Mar 2003 17:00:36 -0800


I'm having exception on connection with database, I wonder
what's wrong here
Option Explicit On
Imports System
Imports System.IO
Imports System.Data.SqlDbType
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.Data.OleDb.OleDbConnection

Public Class Add
    Shared Sub main()
        Dim Add = New DB_Check()
        Add.DB_ADODB()
    End Sub
    Public Sub DB_Check()
        On Error GoTo ErrorHandler
        Dim strConnectionString As String
        Dim Conn As System.Data.OleDb.OleDbConnection
        ' Provider=MSDAORA; Data Source=ORACLE8i7; User
ID=OLEDB; Password=OLEDB
        ' Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=c:\bin\LocalAccess40.mdb;
        'Provider=SQLOLEDB;Data
Source=MySQLServer;Integrated Security=SSPI;

        'GSAPERFSQL01
        strConnectionString = "User
ID=softlib_user;Password=burlapcoats;Initial
Catalog=SMS_GDDG_TEST;Provider=SQLOLEDB;Data
Source=GSAPERFSQL01;Connect Timeout=30"
        Conn = New System.Data.OleDb.OleDbConnection
(strConnectionString)
        

        Dim selectCMD As System.Data.OleDb.OleDbCommand =
New System.Data.OleDb.OleDbCommand("select * from
dbo.tblSMSSurveySession", Conn)

        Dim custDA As System.Data.OleDb.OleDbDataAdapter =
New System.Data.OleDb.OleDbDataAdapter()
        custDA.SelectCommand = selectCMD

        Dim custDS As DataSet = New DataSet()

        custDA.Fill(custDS, "dbo.tblSMSSurveySession")

        Dim pRow
        For Each pRow In custDS.Tables
("dbo.tblSMSSurveySession").Rows
            Console.WriteLine(pRow("CustomerID").ToString
())

        Next

        Exit Sub
ErrorHandler:
        Err.Raise(Err.HelpFile & " ", " " &
Err.Number, " " & Err.Description)

    End Sub

   End Class



Relevant Pages

  • Re: Interaction between the classes
    ... Imports System.Windows.Forms ... Public Class myKeyClass Implements owf.IMessageFilter ... Overridable Function PreFilterMessageAs Boolean Implements owf.IMessageFilter.PreFilterMessage ... Public Sub New ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Intercepting the WM_HELP message
    ... Imports System.Drawing ... End Sub ... Public Class MessageFilter ... eMVP" wrote in message ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Data access and vb class file from .net novise
    ... after Imports myapp.net.Class1 ... > Public Class WebForm3 ... > Private Sub Page_Load(ByVal sender As System.Object, ... > Shared Function getSimpleData ...
    (microsoft.public.dotnet.framework.adonet)
  • vb.net error while registering evevents
    ... Evidence assemblySecurity, String[] args) ... Imports System.Runtime.Remoting.Channels.Http ... Public Class Client ... Public Sub New ...
    (microsoft.public.dotnet.languages.vb)
  • RE: problem with serializer constructor
    ... Mark, I have same problem as yours. ... Looks like it is unable to create permission set. ... > Imports System.Xml ... > Public Class PurchaseOrder ...
    (microsoft.public.dotnet.xml)