Re: Connectivity Problem of Sql Server2000 and ASP/ASP.NET
-
Dear friends , I m in trouble by this problem: I have to read records from table ethnicity(with two cols)from sql server2000. my asp.net code is given below. ============================================================================= <%@ Page Language="vb" %> <%@ Import Namespace="System.data" %> <%@ Import Namespace="System.data.Oledb" %> sub Page_load(obj as object, e as eventargs) dim connection1 as new oledbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Scineceoflife;Data Source=amit-5;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=AMIT-5;Use Encryption for Data=False;Tag with column collation when possible=False") dim objcmd as new OleDbDataAdapter("select * from Ethnicity", connection1) dim ds as DataSet=new DataSet() objcmd.Fill(ds, "ethnicity") dim dt as datatable=ds.Tables("ethnicity") Dim CurrRows() as DataRow=dt.select(Nothing,nothing, DataViewRowState.CurrentRows) Dim I,J as Integer Dim Stroutput as String For I=0 to CurrRows.Length-1 For j=0 to dt.columns.count-1 stroutput=stroutput & dt.columns(j).Columnname & "="& _ CurrRows(I)(J).ToString & "<BR>" next next Response.write(stroutput) end sub ============================================================================== after building it i find following message: ============================================================================= <big>Login failed for user 'AMIT-5\ASPNET'. </big> 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.OleDb.OleDbException: Login failed for user 'AMIT-5\ASPNET'. Source Error: Line 9: Line 10: dim ds as DataSet=new DataSet() <b>Line 11: objcmd.Fill(ds, "ethnicity")</b> Line 12: dim dt as datatable=ds.Tables("ethnicity") Line 13: Dim CurrRows() as DataRow=dt.select(Nothing,nothing, DataViewRowState.CurrentRows) Source File: d:\inetpub\wwwroot\scienceoflife\WebForm6.aspx Line: 11 Stack Trace: ============================================================================== amit-5 is my computer name, login id is 'Administrator', passwd is blank plz consider it ! With regards :mad: </x-turndown>
-
Dear friends , I m in trouble by this problem: I have to read records from table ethnicity(with two cols)from sql server2000. my asp.net code is given below. ============================================================================= <%@ Page Language="vb" %> <%@ Import Namespace="System.data" %> <%@ Import Namespace="System.data.Oledb" %> sub Page_load(obj as object, e as eventargs) dim connection1 as new oledbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Scineceoflife;Data Source=amit-5;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=AMIT-5;Use Encryption for Data=False;Tag with column collation when possible=False") dim objcmd as new OleDbDataAdapter("select * from Ethnicity", connection1) dim ds as DataSet=new DataSet() objcmd.Fill(ds, "ethnicity") dim dt as datatable=ds.Tables("ethnicity") Dim CurrRows() as DataRow=dt.select(Nothing,nothing, DataViewRowState.CurrentRows) Dim I,J as Integer Dim Stroutput as String For I=0 to CurrRows.Length-1 For j=0 to dt.columns.count-1 stroutput=stroutput & dt.columns(j).Columnname & "="& _ CurrRows(I)(J).ToString & "<BR>" next next Response.write(stroutput) end sub ============================================================================== after building it i find following message: ============================================================================= <big>Login failed for user 'AMIT-5\ASPNET'. </big> 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.OleDb.OleDbException: Login failed for user 'AMIT-5\ASPNET'. Source Error: Line 9: Line 10: dim ds as DataSet=new DataSet() <b>Line 11: objcmd.Fill(ds, "ethnicity")</b> Line 12: dim dt as datatable=ds.Tables("ethnicity") Line 13: Dim CurrRows() as DataRow=dt.select(Nothing,nothing, DataViewRowState.CurrentRows) Source File: d:\inetpub\wwwroot\scienceoflife\WebForm6.aspx Line: 11 Stack Trace: ============================================================================== amit-5 is my computer name, login id is 'Administrator', passwd is blank plz consider it ! With regards :mad: </x-turndown>
Create login for AMIT-5\ASPNET in SQL server. //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke