thank you for intersting to my problem but the problem still i dont know what can i do
this is the ERROR message :-
Login failed for user 'SHADID\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'SHADID\ASPNET'.
Source Error:
Line 50:
Line 51: 'cmd.CommandText = ("insert into reg values ('" & lb1.Text.Trim & "','" & lb2.Text.Trim & "')" & "con")
Line 52: myconnection.Open()
Line 53: cmd.ExecuteNonQuery()
Line 54: myconnection.Close()
and this is the code:
Imports System.configuration
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
Dim myconnection As SqlConnection
Dim cmd As SqlCommand
'Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("workstation"))
'Dim cmd As New SqlCommand
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
myconnection = New SqlConnection("server = shadid;database=sh;Trusted_Connection=Yes")
'cmd.Connection = myconnection
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'cnn = New SqlConnection("Driver={SQL Server};User ID=Admin;Database=sh")
Dim strcmd As String = "insert into reg values ('" & lb1.Text.Trim & "','" & lb2.Text.Trim & "' "
cmd = New SqlCommand(strcmd, myconnection)
'cmd.CommandText = ("insert into reg values ('" & lb1.Text.Trim & "','" & lb2.Text.Trim & "')" & "con")
myconnection.Open()
cmd.ExecuteNonQuery()
myconnection.Close()
Response.Redirect("WebForm2.aspx")
End Sub
End Class
and i write in web config. this statement :
<appSettings>
<add key="workstation" value="data source=shadid;
User ID=admin;initial catalog=sh;persist security info=False;packet size=4096"/>
</appSettings>
please advice me iam thanking you very much for your intersting
thank you again