R
renu renu via .NET 247
(Type your message here)
--------------------------------
From: renu
Friends,
when I am trying to create a login page and connecting to the sqlserver database I am getting the following error
ExecuteReader requires an open and available Connection. The connection's current state is Closed.
and mycode is
Dim strconn As String
Dim strsql As String
Dim command As SqlCommand
Dim i As Integer
Try
strconn = "server =(local);trusted_connection=yes;database=consultants;"
Response.Write("connection ok")
Dim conn As New SqlConnection(strconn)
strsql = "select count(*) from consul_login where uname='" & txtUname.Text & "'and pword='" & txtPassword.Text & "'"
command = New SqlCommand(strsql, conn)
conn.Open()
Catch ex As Exception
Response.Write(ex.Message)
End Try
i = command.ExecuteScalar()
If i <> 1 Then
Response.Redirect("e:\dotnet\authenticationdenied.aspx")
Else
Response.Redirect("e:\dotnet\timesheet.aspx")
Response.Redirect("timesheet?n1" & txtUname.Text)
End If
can anybody help me out?
thanks
renu
--------------------------------
From: renu
Friends,
when I am trying to create a login page and connecting to the sqlserver database I am getting the following error
ExecuteReader requires an open and available Connection. The connection's current state is Closed.
and mycode is
Dim strconn As String
Dim strsql As String
Dim command As SqlCommand
Dim i As Integer
Try
strconn = "server =(local);trusted_connection=yes;database=consultants;"
Response.Write("connection ok")
Dim conn As New SqlConnection(strconn)
strsql = "select count(*) from consul_login where uname='" & txtUname.Text & "'and pword='" & txtPassword.Text & "'"
command = New SqlCommand(strsql, conn)
conn.Open()
Catch ex As Exception
Response.Write(ex.Message)
End Try
i = command.ExecuteScalar()
If i <> 1 Then
Response.Redirect("e:\dotnet\authenticationdenied.aspx")
Else
Response.Redirect("e:\dotnet\timesheet.aspx")
Response.Redirect("timesheet?n1" & txtUname.Text)
End If
can anybody help me out?
thanks
renu