I am facing problem in connection. This code is OK , when i Deploy or Create a EXE of this project and install it on other system then the connection error generates, whats the solution to create a globel connection, any body tell me ,,,,,,,......
[code=vbnet]
Public Class Utils
'//*************** * Connection MUNNA-AB15B2413\SQLEX PRESS
Public Shared Connection As String = "Server='MU NNA-AB15B2413\SQLEX PRESS';uid=sa;p wd=123;Initial Catalog=ICS"
End Class
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdlogin.Click
Dim con As New SqlConnection(U tils.Connection )
con.Open()
Dim Query As String = "Select * from Login WHERE username = '" + txtusrname.Text + "' and password = '" + txtpwd.Text + "'"
Dim cmd As New SqlCommand(Quer y, con)
Dim reader As SqlDataReader = cmd.ExecuteRead er
If reader.Read Then
Main.Show()
Me.Hide()
Else
MsgBox("Invalid Username / Password")
End If
End Sub[/code]
[code=vbnet]
Public Class Utils
'//*************** * Connection MUNNA-AB15B2413\SQLEX PRESS
Public Shared Connection As String = "Server='MU NNA-AB15B2413\SQLEX PRESS';uid=sa;p wd=123;Initial Catalog=ICS"
End Class
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles cmdlogin.Click
Dim con As New SqlConnection(U tils.Connection )
con.Open()
Dim Query As String = "Select * from Login WHERE username = '" + txtusrname.Text + "' and password = '" + txtpwd.Text + "'"
Dim cmd As New SqlCommand(Quer y, con)
Dim reader As SqlDataReader = cmd.ExecuteRead er
If reader.Read Then
Main.Show()
Me.Hide()
Else
MsgBox("Invalid Username / Password")
End If
End Sub[/code]
Comment