claracruz
asked on
Get schema and gridview problem
Hello experts,
I found the following article for getting a schema for an access database;-
http://aspalliance.com/542
I need to get the schema for a DB2 database, and I'm wondering if it will follow the same principle as the example in the link above. So I have done the following;-
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbCon nection OleDbConnection1 =
new System.Data.OleDb.OleDbCon nection("P rovider=DB 2OLEDB;Net work Transport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;In itial Catalog=MyCtlg;Package Collection=MyPkgCol;Defaul t Schema=Schema;User ID=MyUser;Password=MyPW";
OleDbConnection1.Open();
System.Data.DataTable DataTable1 = OleDbConnection1.GetSchema ();
OleDbConnection1.Close();
GridView1.DataSource = DataTable1;
GridView1.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Database Schema</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:gridview ID="GridView1" runat="server">
</asp:gridview>
</div>
</form>
</body>
</html>
So my question is twofold,
1. Will this work, if not, is there actually a method for getting an IBM DB2 database schema
2. I get the following error at the moment when I run the above code;-
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type System.Web.UI.WebControls. gridview from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d 50a3a.
Source Error:
Line 22: <form id="form1" runat="server">
Line 23: <div>
Line 24: <asp:gridview ID="GridView1" runat="server">
Line 25: </asp:gridview>
Line 26: </div>
Many Thanks.
I found the following article for getting a schema for an access database;-
http://aspalliance.com/542
I need to get the schema for a DB2 database, and I'm wondering if it will follow the same principle as the example in the link above. So I have done the following;-
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbCon
new System.Data.OleDb.OleDbCon
OleDbConnection1.Open();
System.Data.DataTable DataTable1 = OleDbConnection1.GetSchema
OleDbConnection1.Close();
GridView1.DataSource = DataTable1;
GridView1.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Database Schema</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:gridview ID="GridView1" runat="server">
</asp:gridview>
</div>
</form>
</body>
</html>
So my question is twofold,
1. Will this work, if not, is there actually a method for getting an IBM DB2 database schema
2. I get the following error at the moment when I run the above code;-
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type System.Web.UI.WebControls.
Source Error:
Line 22: <form id="form1" runat="server">
Line 23: <div>
Line 24: <asp:gridview ID="GridView1" runat="server">
Line 25: </asp:gridview>
Line 26: </div>
Many Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.