Title:   Connection error (SQL Server 2005)
Web-Link: http://www.arabteam2000-forum.com/index.php?showtopic=120758
Description: SQLExpress
Department: ADO.NET forum
Develop Using: Microsoft Visual Basic 2005
Assistant Tool(s): SQL Express
Version: 1.00
Last update: 16 March 2007
Date: 16 March 2007
Time Zone: (GMT + 02:00) Cairo
Author: Eng. Usama El-Mokadem: musama@hotmail.com

Topic(120758) [Mar 15 2007, 11:52 PM]: By projet: http://www.arabteam2000-forum.com/index.php?showuser=105577
=======
-----BEGIN TOPIC-----
  
      
      2005      2005         
keyword not supported 'provider'
:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New SqlClient.SqlConnection()
Dim sql As String = "insert into mydbTable1 (name,number) values " & _
"('" & TextBox1.Text & "','" & TextBox2.Text & "')"
con.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=mydatabase;Data Source=nano"
Try
con.Open()
Dim cmd As New SqlClient.SqlCommand(sql, con)
Label1.Text = cmd.ExecuteNonQuery().ToString
Catch e1 As SqlClient.SqlException
Label1.Text = e1.Message
End Try
End sub
      
 
              
-----END TOPIC-----

Solution:
=======
-----BEGIN SOLUTION-----
  

        con.ConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=mydatabase;Integrated Security=True"

        con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\mydatabase.mdf;Integrated Security=True;User Instance=True"

  
-----END SOLUTION-----

Attachments:
============
SQLExpress.zip
The (Attached) Solution Suggested By Eng. Usama El-Mokadem: http://www.arabteam2000-forum.com/index.php?showuser=98027

CONTACT INFORMATION:
=======================
  Eng. Usama El-Mokadem
  Email: musama@hotmail.com
  Web: http://musama.tripod.com
  Mobile: 0020 10 1289308
  Egypt