C
Chumley Walrus
I've got a c# script whereas I am trying to post from a textbox on my
firstpage.aspx over to page2.aspx, but the error I get is:The name
'txtstuff' does not exist in the class or namespace 'ASP.page2_aspx'
firstpage.aspx button object subroutine:
///////////////////////
private void btnSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("dg4.aspx?txtboarddate=" +
this.txtboarddate.Text);
}
///////////////////////
page2.aspx script:
//////////////////////////////////////////
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<script Language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
txtstuff = Request.QueryString["txtstuff"];
if(txtstuff != null){
if(txtstuff =="") txtstuff = "Visitor";
}
////txtstuff = Request.QueryString["txtstuff "];
////this.txtstuff .Text = Request.QueryString["txtstuff "];
BindMe();
}
// function to bind the records retrieved
// from the database to "dgrid" grid
void BindMe() {
////
string txtstuff = Request.QueryString["txtstuff"];
// build the connection string
string strConn = "SERVER=xxx.xx.xx.xx;UID=xxx;PWD=xxxx;DATABASE=mydb;";
// connect to the database
SqlConnection objConn = new SqlConnection(strConn);
// query
string strSQL = "SELECT * FROM tblDb where MyDate = '" & txtstuff &
"'";
// create an instance of the DataReader object
SqlCommand objCommand = new SqlCommand(strSQL, objConn);
objConn.Open();
SqlDataReader objReader = objCommand.ExecuteReader();
// assign the DataReader object as the source
// for the "dgrid" grid
dgrid.DataSource = objReader;
dgrid.DataBind();
// free up memory
objReader.Close();
objConn.Close();
}
</script>
???????????????
chumley
firstpage.aspx over to page2.aspx, but the error I get is:The name
'txtstuff' does not exist in the class or namespace 'ASP.page2_aspx'
firstpage.aspx button object subroutine:
///////////////////////
private void btnSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("dg4.aspx?txtboarddate=" +
this.txtboarddate.Text);
}
///////////////////////
page2.aspx script:
//////////////////////////////////////////
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<script Language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
txtstuff = Request.QueryString["txtstuff"];
if(txtstuff != null){
if(txtstuff =="") txtstuff = "Visitor";
}
////txtstuff = Request.QueryString["txtstuff "];
////this.txtstuff .Text = Request.QueryString["txtstuff "];
BindMe();
}
// function to bind the records retrieved
// from the database to "dgrid" grid
void BindMe() {
////
string txtstuff = Request.QueryString["txtstuff"];
// build the connection string
string strConn = "SERVER=xxx.xx.xx.xx;UID=xxx;PWD=xxxx;DATABASE=mydb;";
// connect to the database
SqlConnection objConn = new SqlConnection(strConn);
// query
string strSQL = "SELECT * FROM tblDb where MyDate = '" & txtstuff &
"'";
// create an instance of the DataReader object
SqlCommand objCommand = new SqlCommand(strSQL, objConn);
objConn.Open();
SqlDataReader objReader = objCommand.ExecuteReader();
// assign the DataReader object as the source
// for the "dgrid" grid
dgrid.DataSource = objReader;
dgrid.DataBind();
// free up memory
objReader.Close();
objConn.Close();
}
</script>
???????????????
chumley