Problems With Useing Ms2000 Sql
Jan 25, 2005I am new at this and I am getting though a book that is teaching me asp.net
I have experance with vb but I am having truble with the connection to my sql server
<%@ Page Language="VB" debug="true" %>
<script runat="server">
Function MyQueryMethod() As System.Data.SqlClient.SqlDataReader
Dim connectionString As String = "server='68.250.171.129'; trusted_connection=true; Database='working'"
Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "SELECT [personaldata].* FROM [personaldata]"
Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)
sqlConnection.Open
Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Return dataReader
End Function' Insert page code here
Sub Page_load(sender as object, e as EventArgs)
dgCustomers.DataSource = MyQueryMethod()
dgCustomers.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:DataGrid id="dgCustomers" runat="server"></asp:DataGrid>
<!-- Insert content here -->
</form>
</body>
</html>
This page works fine when I use the web matrix project, web server. I cannot get it to work when I use my win2000 servers iis server.
this is the error I am getting
Server Error in '/aspnet_client' Application.
--------------------------------------------------------------------------------
Invalid object name 'personaldata'.
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: Invalid object name 'personaldata'.
Source Error:
Line 10:
Line 11: sqlConnection.Open
Line 12: Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Line 13:
Line 14: Return dataReader
Source File: D:serverWEBaspnet_clientSimpleDataGrid.aspx Line: 12
Stack Trace:
[SqlException: Invalid object name 'personaldata'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +45
ASP.SimpleDataGrid_aspx.MyQueryMethod() in D:serverWEBaspnet_clientSimpleDataGrid.aspx:12
ASP.SimpleDataGrid_aspx.Page_load(Object sender, EventArgs e) in D:serverWEBaspnet_clientSimpleDataGrid.aspx:17
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Please can anyone help