Results 1 to 6 of 6

Thread: Trouble with SQLConn string

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    28

    Trouble with SQLConn string

    Can any one tell me what the connection string for a SQL connection should be for :--

    Dim dbconn As New SqlConnection _("DataSource=C:\PROJECTS\GraphicsProject.mdb")

    I am working on a standalone computer and do not know the exact name of the sql server. Do I need this and if so, how do i find it ?

    Thanks a million.
    Regards --
    Vujjeni

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    I think you need an OleDB connection instead of SqlConnection.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Here it's highlighted in red . http://www.sitepoint.com/article/1005/2 too lazy to copy it here . lol

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    28
    Thanks for your replies.
    I have decided to go with OledbConn object for now.
    I am using it for access database so I am not sure if SQLConn works there. I have a problem with oleDBDataAdapter though..when I use its fill method I keep getting this error :

    An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

    This was the reason why I thought of switching to SQLConnection.
    Appreciate your help.
    Regards --
    Vujjeni

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    This is what I always use . If your database isn't password-protected then leave MyPassword variable set to Nothing otherwise , you can type it there .
    VB Code:
    1. Public Shared MyPath As String = Application.StartupPath & "\AppDb.mdb"
    2.     Public Shared MyPassword As String = Nothing
    3.     Public Shared MyConnection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MyPath & ";Jet OLEDB:Database Password=" & MyPassword)

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    aah , I hate this . Just replace that laughing face with : and D letter .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width