Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2005, 08:24 PM
Registered User
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default fail login sql database...

OS : windows server 2003
DB : SQL server 2000

Would you help me?

case1

    string conn = "server=localhost; database=Dotnet; uid=sa; pwd=;";
    SqlConnection connection = new SqlConnection(conn);
    connection.Open();

This case1 is occurred Exception(System.InvalidCastException)

[InvalidCastException: ÁöÁ¤ÇÑ Ä³½ºÆ®°¡ À߸øµÇ¾ú½À´Ï´Ù.]
   ASP.control_test_aspx.Setmyname(Object src, EventArgs e) +133
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1277



case2

    string conn = "server=localhost; database=Northwind; uid=sa; pwd=;";
    SqlConnection connection = new SqlConnection(conn);
    connection.Open();

This case2 is not occurred Exception. Login success.

Q1. I don't understand above state. Why case1 have CastExeption?

case3

    string conn = "server=localhost; database=Northwind; uid=Administrator; pwd=star_3327;";
    SqlConnection connection = new SqlConnection(conn);
    connection.Open();

This case3 can't login sql server(System.Data.SqlClient.SqlException).

[SqlException: 'Administrator' »ç¿ëÀÚ°¡ ·Î±×ÀÎÇÏÁö ¸øÇß½À´Ï´Ù.]
   System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) +472
   System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
   System.Data.SqlClient.SqlConnection.Open() +384
   ASP.control_test_aspx.Setmyname(Object src, EventArgs e) +72
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1277

Q2. Why case3 can't login?



 
Old November 17th, 2005, 11:18 AM
Authorized User
 
Join Date: Nov 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think there is a SQL Server Internal error. Just see,case 1 and case 2 is custom created but case 2 is automatically created when u installed SQL Server.
I have kept ur query in mind and give u reply as soon as possible. But I think it is internal error. Check the same think in wizard basis that ships in VS.NET and check the "TEST CONNECTION".

Subhendu De
Software Developer
New Delhi

Subhendu De
 
Old November 22nd, 2005, 08:20 PM
Registered User
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

when we use ASP in same state, we success login.

This is ASP source code

DbConn.asp
<%
Function DbOpen(objCon)
    set objCon = server.createObject("ADODB.Connection")
    objCon.Open "Provider=SQLOLEDB.1;Password=sa_3327;Persist Security Info=True;User ID=sa;Initial Catalog=Dotnet;Data Source=star"
End Function

Function DbClose(objCon)
    objCon.close
    set objCon = nothing
End Function
%>


test.asp

<%
name=request("name")
address=request("name")
telephone=request("telephone")
if name <> "" then
    Call DbOpen(Conn)
    Conn.BeginTrans
    ON ERROR RESUME NEXT

    sqlstr="insert into test_info (name,address,telephone) values "
    sqlstr=sqlstr&"('"&name&"','"&address&"','"&teleph one&"')"
    Conn.Execute(sqlstr)
    Error_cnt=Error_cnt+Conn.Errors.Count

    if Error_cnt = 0 then
        Conn.CommitTrans
        Response.write "<script language=JavaScript>alert('µî·ÏµÇ¾ú½À´à Â´Ã™.');</script>"
    Else
        Conn.RollbackTrans
        Response.write "<script language=JavaScript>alert('\n Database ¿¡·¯!!');history.back();</script>"
    End If

    Call DBClose(Conn)
end if
%>
<html>
<body>
<form name="theForm" action="test.asp" method="post">
<table>
<tr>
    <td>À̸§</td>
    <td><input type="text" size="10" name="name" value=""></td>
</tr>
<tr>
    <td>ÁÖ¼Ò</td>
    <td><input type="text" size="50" name="address" value=""></td>
</tr>
<tr>
    <td>¿¬¶ôó</td>
    <td><input type="text" size="20" name="telephone" value=""></td>
</tr>
<tr>
    <td colspan=2 align=center><input type="submit" size="20" name="btn" value="µî·Ï"></td>
</tr>
</table>
</form>
</body>
</html>






Similar Threads
Thread Thread Starter Forum Replies Last Post
fail login sql server junghyun baek ASP.NET 1.0 and 1.1 Professional 0 November 16th, 2005 06:22 PM
Crystal Report login Fail Database in another comp cubansalsa Pro VB 6 0 January 24th, 2005 07:17 PM
Login Fail - Access a Crystal Report from . NET rsk Crystal Reports 0 August 17th, 2004 07:29 AM
login fail by user 'sa' in .net framework 1.1 sara_1981 BOOK: Beginning ASP 3.0 3 August 2nd, 2004 07:26 AM
sa login fail...can't find where to fix it pdr1165 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 March 24th, 2004 04:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.