Nightcat
03-16-2009, 08:56 AM
I have a script that connects to a db called "cards_db.mbd"
but when I run it, nothing happens ^(
although on the page does not return any errors now :confused:
<%@ Page Language="c#" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
void PageLoad()
{
OleDbConnection conn = new OleDbConnection() ; //Build connection object
string connectionStr;
connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
connectionStr += "Data Source= \"cards_db.mdb\"";
conn.ConnectionString = connectionStr;
//set up a query
string queryString = "select all from cards_table where card_type=\"recognize\"";
OleDbCommand dbCommand = new OleDbCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = conn; //Build command object
conn.Open(); //Connection is open
OleDbDataReader cards_dataReader = dbCommand.ExecuteReader(); //This constructs the DataReader and fills it in
// Bind the dataReader to the datagrid dg1 //
dg1.DataSource = cards_dataReader;
dg1.DataBind();
cards_dataReader.Close();
while(cards_dataReader.Read()){
string card_id=Convert.ToString(cards_dataReader["card_id"]);
string link_to_image=Convert.ToString(cards_dataReader["link_to_image"]);
card.Text = card_id;
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form runat="server">
<asp:DataGrid id="dg1" runat="server"></asp:DataGrid>
<asp:Label id="card" runat="server"></asp:Label>
</form>
</body>
</html>
but when I run it, nothing happens ^(
although on the page does not return any errors now :confused:
<%@ Page Language="c#" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
void PageLoad()
{
OleDbConnection conn = new OleDbConnection() ; //Build connection object
string connectionStr;
connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
connectionStr += "Data Source= \"cards_db.mdb\"";
conn.ConnectionString = connectionStr;
//set up a query
string queryString = "select all from cards_table where card_type=\"recognize\"";
OleDbCommand dbCommand = new OleDbCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = conn; //Build command object
conn.Open(); //Connection is open
OleDbDataReader cards_dataReader = dbCommand.ExecuteReader(); //This constructs the DataReader and fills it in
// Bind the dataReader to the datagrid dg1 //
dg1.DataSource = cards_dataReader;
dg1.DataBind();
cards_dataReader.Close();
while(cards_dataReader.Read()){
string card_id=Convert.ToString(cards_dataReader["card_id"]);
string link_to_image=Convert.ToString(cards_dataReader["link_to_image"]);
card.Text = card_id;
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form runat="server">
<asp:DataGrid id="dg1" runat="server"></asp:DataGrid>
<asp:Label id="card" runat="server"></asp:Label>
</form>
</body>
</html>