Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Change username and password

Author  Topic 

poornima
Starting Member

32 Posts

Posted - 2006-09-30 : 03:51:48
Hello

I newly installed the SQL Server 2005.During installation i chose the option Mixed Mode.I aslo did nit mention any user name and password to the SQL Server.Iam able successfully create Databases using the SQL Server Management Studio.
My problem iam unable to connec to the SQL Server from my .net windows application.My application code is

Dim strCon As String
Dim sValue As String
Dim strQuery As String
Dim dsEventTransac As New DataSet
Dim daEventTransac As New SqlClient.SqlDataAdapter
Dim rowCount As New Integer
Dim oWebService As New WebReference.TkmService
'Dim nwRow As DataRow
'Dim delCmd As SqlClient.SqlCommand


strQuery = "SELECT * FROM EventTransaction"

strCon = "Data Source=localhost;integrated security=SSPI;initial catalog=KmsDb;User ID=sa;password="
objCon = New SqlClient.SqlConnection(strCon)
If objCon.State = ConnectionState.Closed Then
objCon.Open()
End If
daEventTransac = New SqlClient.SqlDataAdapter(strQuery, objCon)
Dim cmdBuilder As New SqlClient.SqlCommandBuilder(daEventTransac)
daEventTransac.Fill(dsEventTransac)

'update the DataAdapter
daEventTransac.Update(dsEventTransac)
oWebService.Url = "http://192.168.0.10/TkmService1/TkmService.asmx"

''display the table in a grid
dgEventTransac.DataSource = dsEventTransac.Tables(0)

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles dgEventTransac.Navigate

End Sub
End Class

When i donot specify user ID and password i get connected correctly.But when i run the above code i get an error
"Unable to connect to the remote server"
Now i want to change the username and password.Please tell me how to do

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-09-30 : 04:05:51
In SQL Server 2005, the remote connections are not enabled by default.

you need to enable it.
Follow the following steps,

1) Go to Microsoft SQL Server 2005->Configuration Tools->SQL Server Surface Area Configuration.

2) Click on Surface Area Configuration for Services and Connections

3) Then click on Remote Connections and Enable Local and Remote Connections.

Hope this solves yourr issue.

Chirag
Go to Top of Page

poornima
Starting Member

32 Posts

Posted - 2006-09-30 : 04:44:16
Thnaks Chirag,my problem got resolved.
Apart from what you specified we also granted a SELECT permission to the Database from which we passed a DataSet.
Thank you and have a nice day
Go to Top of Page
   

- Advertisement -