sphericalx
New member
- Joined
- Sep 7, 2008
- Messages
- 3
- Programming Experience
- 1-3
i have tried using the code u provided, however i encountered a error while debugging and below is the error msg.
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
anyway, i'm using vb 2005 express edition & sql server 2000.
thanks,
ron
i have manage to get it working alr.
[original]Dim str_connection As String = "Data Source=local;User ID=myid;Password=mypwd;Initial Catalog=FinBank
[changed]Dim str_connection As String = "Data Source=127.0.0.1;User ID=myid;Password=mypwd;Initial Catalog=FinBank
anyway, anyone know how to parse the value into datagrid?
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
anyway, i'm using vb 2005 express edition & sql server 2000.
VB.NET:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim str_sql_user_select As String = "SELECT * FROM client"
Dim str_connection As String = "Data Source=local;User ID=myid;Password=mypwd;Initial Catalog=FinBank"
Dim mycon As SqlConnection
Dim comUserSelect As SqlCommand
Dim myreader As SqlDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mycon = New SqlConnection(str_connection)
'Instantiate the commands
comUserSelect = New SqlCommand(str_sql_user_select, mycon)
TextBox1.Text = " "
TextBox2.Text = " "
mycon.Open()
myreader = comUserSelect.ExecuteReader
If (myreader.Read = True) Then
TextBox1.Text = myreader(0)
TextBox2.Text = myreader(1)
Else
MsgBox("You have reached eof")
End If
End Sub
End Class
thanks,
ron
i have manage to get it working alr.
[original]Dim str_connection As String = "Data Source=local;User ID=myid;Password=mypwd;Initial Catalog=FinBank
[changed]Dim str_connection As String = "Data Source=127.0.0.1;User ID=myid;Password=mypwd;Initial Catalog=FinBank
anyway, anyone know how to parse the value into datagrid?
Last edited: