09. maj 2012 - 23:19Der er
15 kommentarer og 1 løsning
Connectionstring
Forsøger at få forbindelse til min nye SQL server Compact Edition fra Visaul Basic 2010 Express. Jeg får imidlertid fejl når jeg forsøger at connecte. Har forsøgt følgende:
Private Conn As String = "Data Source=C:\BySommer.sdf; Initial Catalog=BYSommer;USER ID=xxxxx;Password=xxxxx;"
Private Conn As String = "Data Source=BySommer.sdf;Persist Security Info=False;"
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Dim Connection As New SqlCeConnection(Conn) Connection.Open() Dim BrugerID = TextBox1.Text Dim Cmd As New SqlCommand("Insert into Adgang Brugernavn, Navn) VALUES @Brugernavn, @Navn", Connection) With Cmd .Parameters.Add("@Brugernavn", SqlDbType.NVarChar,100) .Parameters("@Brugernavn").Value = TextBox1.Text .Parameters.Add("@Navn", SqlDbType.NVarChar, 100) .Parameters("@Navn").Value = TextBox2.Text
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.