Error in Connection string for VB.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HPATEL
    New Member
    • Jan 2008
    • 1

    Error in Connection string for VB.NET

    Hi,

    I have a connection string in vb.net as below with access db.
    [code=vbnet]
    Public Const OLEDB_CONNECTIO N_STRING As String = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source=Applicat ion.StartupPath () & "\Chirag.mdb"Je t OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1; Provider=Micros oft.Jet.OLEDB.4 .0;Jet OLEDB:System database=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False; Jet OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica Repair=False;Us er ID=Admin;Jet OLEDB:Encrypt Database=False"
    [/code]

    on compiling i get an error which says that "End of Statement Expected"

    Could anyone please help me on this.

    I need it urgently

    Thanks!
    Last edited by Plater; Jan 10 '08, 02:52 PM. Reason: adding CODE tags
  • PareshRathod
    New Member
    • Mar 2007
    • 28

    #2
    Hi Guy,

    Check the string i am pasting here... something was missing, that you will have to find yourself...

    Dont't worry I am making it bold, it was silly mistake... :)

    Public Const OLEDB_CONNECTIO N_STRING As String = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source=" & Application.StartupPath() & "\Chirag.mdb;Je t OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1; Provider=Micros oft.Jet.OLEDB.4 .0;Jet OLEDB:System database=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False; Jet OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica Repair=False;Us er ID=Admin;Jet OLEDB:Encrypt Database=False"

    Say thanks if you get solved....
    Paresh

    Originally posted by HPATEL
    Hi,

    I have a connection string in vb.net as below with access db.
    Public Const OLEDB_CONNECTIO N_STRING As String = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source=Applicat ion.StartupPath () & "\Chirag.mdb"Je t OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1; Provider=Micros oft.Jet.OLEDB.4 .0;Jet OLEDB:System database=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False; Jet OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica Repair=False;Us er ID=Admin;Jet OLEDB:Encrypt Database=False"


    on compiling i get an error which says that "End of Statement Expected"

    Could anyone please help me on this.

    I need it urgently

    Thanks!

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      modify urstring as

      Public Const OLEDB_CONNECTIO N_STRING As String = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source="& Application.Sta rtupPath() & "\Chirag.mdb"Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1; Provider=Micros oft.Jet.OLEDB.4 .0;Je t OLEDB:System database=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False; Jet OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica Repair=False;Us er ID=Admin;Jet OLEDB:Encrypt Database=False"

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        When you put the code into the correct code tag, the error appears to be obvious. The others have found it for you.

        Comment

        • llorracj
          New Member
          • Jan 2008
          • 6

          #5
          I would suggest taking a look at the OleDbConnection StringBuilder class. Using this eliminates a lot of typographical errors.

          Comment

          Working...