Sql Connectionstring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OuTCasT
    Contributor
    • Jan 2008
    • 374

    Sql Connectionstring

    Hi all.

    I have a complete application now.
    I want to save my sql database in my project bin/debug folder so that it can read directly from there.

    I just cant seem to get the connectionstrin g correct.

    i know its something like

    [CODE=sql]
    MyConnection = New OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0; Data Source = " + Application.Sta rtupPath + "\MyDataBase.md b")
    [/CODE]

    but that is for an Access Database.
    i have a sql database.

    Can anyone help
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    check this out

    -- ck

    Comment

    • OuTCasT
      Contributor
      • Jan 2008
      • 374

      #3
      Originally posted by ck9663
      check this out

      -- ck

      Hi ck

      so this would be my answer

      [CODE=sql]
      Driver={SQL Native Client};Server= .\SQLExpress;At tachDbFilename= c:\asd\qwe\mydb file.mdf; Database=dbname ;Trusted_Connec tion=Yes
      [/CODE]

      The database is already in SQL manager, do i need to attach it again from the other location ?

      Comment

      Working...