|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi every body...Well I tried the codes of ADO.NET with sql server 2000 but it gives me this message sql server doesn't exist or access denied !!!!!
So What is the solution for this situation??? Although I mentioned the UID n PWD in the code of ADO.NET Thanks |
|
#2
|
|||
|
|||
|
check to make sure you have permissions to the database, stored procedures, and you are in the proper user group for access to the server. ? Are you developing in a test server or live server also check you connections strings
Private Sub Insert_Employee_Phone_Directory() Dim cmdResults As String 'TEST CONNECTION 'Dim strCon As String = ("Integrated Security=SSPI;" & _ ' "Data Source=CSDEV-SQL1;" & _ ' "Initial Catalog=Personnel") NOTE: CSDEV IS THE DEVELOPMENT SERVER PERSONNEL IS THE DATABASE Employee_Phone_Directory IS THE DATABASE TABEL '*** LIVE CONNECTION ********* Dim strcon As String = ("Integrated Security=SSPI;" & _ "Data Source=CS-SQL1;" & _ "Initial Catalog=Personnel") 'COMMENT OUT TEST COMMECTION AND UNCOMMENT THE ABOVE CODE FOR A LIVE CONNECTION ***** Dim cn As New SqlConnection(strCon) Try cn.Open() Catch er As System.Exception MsgBox(er.Message) End Try '*** SROTED PROCEDURE FOR Insert A RECORD ****** Dim cmd As New SqlCommand("usp_Insert_Employee_Phone_Directory", cn) With cmd cmd.CommandType = CommandType.StoredProcedure .CommandText = "usp_Update_Employee_Phone_Directory" .Parameters.Add("@PerFix", cobPreFix.Text) .Parameters.Add("@Last_Name", txtLastName.Text) .Parameters.Add("@First_Name", txtFirstName.Text) .Parameters.Add("@Initial", txtInitial.Text) .Parameters.Add("@suffix", cobSuffix.Text) .Parameters.Add("@Bureau", cobBureau.Text) .Parameters.Add("@Division", cobDivision.Text) .Parameters.Add("@Title", cobTitle.Text) .Parameters.Add("@Phone_Number", txtphone.CtlText) .Parameters.Add("@Intercom", txtExtension.Text) .Parameters.Add("@Fax_Number", txtFax.CtlText) .Parameters.Add("@TDD_Number", txtTdd.CtlText) .Parameters.Add("@Email_Address", txtEmail.Text) End With Try cmd.ExecuteNonQuery() Catch e As Exception MsgBox(e.Message) End Try If cmdResults = 0 Then MsgBox("Record Has Been Added", MsgBoxStyle.OKOnly, "Record Insert") Call Clear_Input() Exit Sub Else MsgBox("Insert Failed", MsgBoxStyle.OKOnly, "Record Update Error") End If End Sub HOPE THIS HELPS YOU ! |
|
#3
|
|||
|
|||
|
its most likely that you have set up ur sql server as windows integrated security change that. go to property section of your server . (in Enterprise Mangaer)
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#4
|
|||
|
|||
|
Hi,
You can try this code to establish a connection to the SQL server (Using SQL Authentication) instead of Windows authentication, as you are currently doing. You can try the following code to connect: dim con as new sqlclient.sqlConnection with con .connectionstring="user id=<Username> ;password=<Password> ;data source=<server name> ;initial catalog=<SQL Database Name>" .open end with But, before that check that both client and server machines are on network. The above code should work. regards, |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > ADO.NET with sql server 2000 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|