Problems With Useing Ms2000 Sql

Jan 25, 2005

I 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

View 2 Replies


ADVERTISEMENT

How Can I Useing SQL6.5 Database After Install SQL7

Apr 19, 1999

Hi:
After I am install SQL7.0 clent tools in my WINDOWS95,
The SQL7.0 database can access very well,
but I am access SQL6.5 database object(tables) then the select data is bad,
why ? help me please.

View 2 Replies View Related

Problem Useing Stored Procedure Form Vb.net

Nov 13, 2006

i have created a stored prcedure but is always give error : and please check the ways is correct using stored procedure

"Procedure or Function 'Add_Cb_Entry' expects parameter '@Date', which was not supplied."

Dim SqlPrm As SqlParameter

Dim SqlCmd As New SqlCommand

With SqlCmd

.Connection = SqlConnection 'this is my connection setting

.CommandText = "Dbo.Add_Cb_Entry"

.CommandType = CommandType.StoredProcedure

End With

SqlPrm = SqlCmd.Parameters.Add("@Cashbook_Id", Nothing)

SqlPrm.Direction = ParameterDirection.Output

SqlPrm = SqlCmd.Parameters.Add("@Date", SqlDbType.DateTime, 8, TxtDate.Text)

SqlPrm.Direction = ParameterDirection.Input

SqlPrm = SqlCmd.Parameters.Add("@Entry_ID", SqlDbType.Int, 4, "4")

SqlPrm = SqlCmd.Parameters.Add("@Entry_Name", SqlDbType.VarChar, 75, "Irfan Imdad Memon")

SqlPrm = SqlCmd.Parameters.Add("@Description", SqlDbType.VarChar, 100, "Chk")

SqlPrm = SqlCmd.Parameters.Add("@Amount", SqlDbType.Money, 13, "1000.20")

SqlPrm = SqlCmd.Parameters.Add("@Type", SqlDbType.NChar, 2, "DB")

SqlPrm = SqlCmd.Parameters.Add("@Entry_Status", SqlDbType.VarChar, 20, "Account")

SqlPrm = SqlCmd.Parameters.Add("@Ref_No", SqlDbType.Int, 4, "1")

SqlPrm = SqlCmd.Parameters.Add("@Ref_Status", SqlDbType.VarChar, 20, "MeterialPurchase")

OpenConnection() 'this is my connection setting

SqlCmd.ExecuteNonQuery()

CloseConnection() 'this is my connection setting

TxtInvoiceNo.Text = SqlCmd.Parameters("@Cashbook_Id").Value

View 1 Replies View Related

Backup Data Base Useing Stored Procedure

Mar 2, 2005

Please Any one give me the Solution for taking DataBase Backup using stored procedures.

Thanks in Advance for Reply

Please give me the Solution....

View 1 Replies View Related

Useing T-SQL Commmand Line Results Save Into A Text File

Mar 7, 2005

Hi,
Any body give me solution,

I've Executed DBCC CHECKDB in the T-SQL in the Query Analyser, then i got results in the Grid, but i wana to store that Information Immidiatly in the Text file, useing T-SQL Script, please help any one how to write T-SQL.

i know that going into menu-Query- Results to File. i don't want to do like that.

I want to save through writing T-SQL Script

Please help any body know....
Thanks in Advance....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved