no se quiere conectar a sql 2000 server
Publicado por felipe largacha (3 intervenciones) el 13/08/2005 01:24:04
estoy poniendo el sigiente codigo y no se quiere conectar a la base de datos
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
'Declare the objects of the SqlConnection,
'SqlDataAdapter, and DataSet classes
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
'Initializing the SqlConnection object
MyConnection = New SqlConnection ("server=(local);uid=;pwd=;database=Northwind")
'Initializing the SqlDataAdapter object with the SQL
'query to access data from the Products table
MyCommand = New SqlDataAdapter("select * from orders",
MyConnection)
'Initializing the DataSet object and filling the data
set with the query result
DS = new DataSet()
MyCommand.Fill(DS,"orders")
'Setting the DataSource property of the DataGrid control
MyDataGrid.DataSource=DS.Tables("orders").DefaultView
'Binding the DataGrid control with the data
MyDataGrid.DataBind()
</script>
<html>
<head>
</head>
<body style="BACKGROUND-COLOR: #f6e4c6">
<tr>
<td>
<h4><xmp id="output" runat="server"> </xmp>
</h4>
</td>
</tr>
</body>
</html>
Y APARECE EL SIGUIENTE ERROR QUE ES LO QUE PASA
Server Error in '/pruebas' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30188: Declaration expected.
Source Error:
Line 10: Dim MyCommand As SqlDataAdapter
Line 11: 'Initializing the SqlConnection object
Line 12: MyConnection = New SqlConnection ("serve=(local);uid=;pwd=;database=Northwind")
Line 13: 'Initializing the SqlDataAdapter object with the SQL
Line 14: 'query to access data from the Products table
Source File: C:\Inetpub\wwwroot\pruebas\seleccion.aspx Line: 12
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
'Declare the objects of the SqlConnection,
'SqlDataAdapter, and DataSet classes
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
'Initializing the SqlConnection object
MyConnection = New SqlConnection ("server=(local);uid=;pwd=;database=Northwind")
'Initializing the SqlDataAdapter object with the SQL
'query to access data from the Products table
MyCommand = New SqlDataAdapter("select * from orders",
MyConnection)
'Initializing the DataSet object and filling the data
set with the query result
DS = new DataSet()
MyCommand.Fill(DS,"orders")
'Setting the DataSource property of the DataGrid control
MyDataGrid.DataSource=DS.Tables("orders").DefaultView
'Binding the DataGrid control with the data
MyDataGrid.DataBind()
</script>
<html>
<head>
</head>
<body style="BACKGROUND-COLOR: #f6e4c6">
<tr>
<td>
<h4><xmp id="output" runat="server"> </xmp>
</h4>
</td>
</tr>
</body>
</html>
Y APARECE EL SIGUIENTE ERROR QUE ES LO QUE PASA
Server Error in '/pruebas' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30188: Declaration expected.
Source Error:
Line 10: Dim MyCommand As SqlDataAdapter
Line 11: 'Initializing the SqlConnection object
Line 12: MyConnection = New SqlConnection ("serve=(local);uid=;pwd=;database=Northwind")
Line 13: 'Initializing the SqlDataAdapter object with the SQL
Line 14: 'query to access data from the Products table
Source File: C:\Inetpub\wwwroot\pruebas\seleccion.aspx Line: 12
Valora esta pregunta


0