Monday, March 12, 2012

why this doesnt work

i new to asp.net, i have use the following code to bind the database to datagrid control.

<%@dotnet.itags.org. Page Language="VB" %>
<%@dotnet.itags.org. import Namespace="System.Data" %>
<%@dotnet.itags.org. import Namespace="System.Data.SqlClient" %>
<script runat="server"
' Insert page code here
'
Sub Page_Load(Sender As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As SqlConnection = New SqlConnection("server='(local)'; trusted_connection=true; database='model'")
Dim MyCommand As SqlCommand = New SqlCommand("SELECT * FROM jobs", myConnection)

DS = new DataSet()
MyCommand.Fill(ds, "jobs")

DataGrid1.DataSource=ds.Tables("jobs").DefaultView
DataGrid1.DataBind()
End Sub
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
</p>
</form>
</body>
</html
AND i always get this error page which doesn't help a lots
Server Error in '/' 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: The compiler failed with error code 1.

Show Detailed Compiler Output:(nothing apear in here)

Show Complete Compilation Source:(same as here)Make sure that your web.config file is well formed. If you are using Visual Studio run the solution without debugging and you should see a detailed error message.

hope this helps,
sivilian

0 comments:

Post a Comment