Connection String Probleme!

  • VB.NET
  • .NET (FX) 1.0–2.0

Es gibt 7 Antworten in diesem Thema. Der letzte Beitrag () ist von Cheffboss.

    Connection String Probleme!

    Moin!
    Ich versuche gerade mit einer lokalen Datenbank zu arbeiten.
    Als Server reicht ein Connection String, aber bei meiner lokalen Datenbank.
    Erscheint immer eine Fehlermeldung!
    Wer von euch hat eine Lösung.
    Man Ziel wäre eine kleines Programm zu speichern, das Daten in eine SQL Datenbank verwaltet.
    Da ich zu Übungszwecken ein kleines Adressbuch programmieren möchte.
    BIG THX :thumbsup:
    Bilder
    • datenbank_error.jpg

      140,33 kB, 1.248×465, 132 mal angesehen
    Visual Basic.NET 8o
    MS-SQL
    8o
    bitte schön Hier gibts die lösung. Dein Conectionstring ist falsch
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."
    @Schamash
    Vielen Dank, für die schnelle Antwort.

    VB.NET-Quellcode

    1. 'conString = "Server=BEVPC\SQLExpress;database=MSDNSolve;Integrated Security=true"
    2. conString = "Server=BEVPC\SQLExpress;database=MSDNSolve;User ID=User1;Pwd=Password1+;Application Name=MyApp"

    Leider bezieht sich der String auch auf einen SQLServer.
    Ist es möglich, dort einfach den Dateipfad zur lokalen Datenbank anzugeben?
    Visual Basic.NET 8o
    MS-SQL
    8o
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."
    Hi,
    Dein Bild zeigt eine sdf, also brauchts du einen Sting für SQLCompact

    Dein 'Directory', geht nur wenn die sdf entsprechend zum Project hinzugefügt wurde.

    Nimm das :

    VB.NET-Quellcode

    1. Dim strDataSource As String = ""
    2. strDataSource = Application.StartupPath + "\" + "mySCL.sdf"


    oder das:

    VB.NET-Quellcode

    1. strDataSource = "Data Source=" + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
    2. "\mySCL.sdf"


    Dann:

    VB.NET-Quellcode

    1. myCnn.ConnectionString = "Data source =" + strDataSource + ";Password=Test!123;Persist Security Info=False;"


    VB.NET-Codetag eingefügt! ~Trade

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Trade“ ()

    VB.NET-Quellcode

    1. Imports System.Data.SqlClient
    2. Public Class Form1
    3. Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    4. Dim strDataSource As String
    5. strDataSource = "Data Source=" + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
    6. "\mySCL.sdf"
    7. Dim con As New SqlConnection("Data source =" + strDataSource + ";Password=Test!123;Persist Security Info=False;")
    8. con.Open()
    9. MsgBox("ok")
    10. End Sub
    11. End Class


    Leider ohne erfolg! Es erscheint die gleiche Fehlermeldung.
    Hile über Googel habe ich noch nicht gefunden!
    Visual Basic.NET 8o
    MS-SQL
    8o
    @An alle
    Vielen Dank!
    Ich habe nun die Lösung!

    VB.NET-Quellcode

    1. Imports System.Data.SqlServerCe
    2. Public Class Form1
    3. Dim conn As SqlCeConnection = Nothing
    4. Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    5. conn = New SqlCeConnection("Data Source = Database1.sdf")
    6. conn.Open()
    7. End Sub


    Für eine Lokale Datenbank bracht man System.Data.SqlServerCe.
    Visual Basic.NET 8o
    MS-SQL
    8o