J
Jim McGivney
Using VS'05 I have a label (LabelFileNum) on an aspx page. I want to set
the text of the lable to the last name, which is a field from a table called
Ante_pedigree from an Access Database.
I use the C# code-behind:
OleDbConnection dbConn = null;
OleDbCommand dCmd = null;
string strConn = null;
string strSQL = null;
// Open data connaction to get name info
strConn =
System.Configuration.ConfigurationManager.AppSettings["oledbConnStr"];
dbConn = new OleDbConnection(strConn);
dbConn.Open();
//Initialize label
LabelFileNum.Text = "";
// Get the last
strSQL = "SELECT LastName FROM Ante_Pedigree Where @AnteNum = ?";
dCmd = new OleDbCommand(strSQL, dbConn);
dCmd.Parameters.AddWithValue("@AnteNum", OleDbType.Char).Value = fileid;
LabelFileNum.Text = LabelFileNum.Text + " " +
dCmd.ExecuteScalar().ToString();
I get the error "No value given for one or more required parameters."
Any suggestions ? This similar code worked in asp.net 1.1
Thanks,
Jim
the text of the lable to the last name, which is a field from a table called
Ante_pedigree from an Access Database.
I use the C# code-behind:
OleDbConnection dbConn = null;
OleDbCommand dCmd = null;
string strConn = null;
string strSQL = null;
// Open data connaction to get name info
strConn =
System.Configuration.ConfigurationManager.AppSettings["oledbConnStr"];
dbConn = new OleDbConnection(strConn);
dbConn.Open();
//Initialize label
LabelFileNum.Text = "";
// Get the last
strSQL = "SELECT LastName FROM Ante_Pedigree Where @AnteNum = ?";
dCmd = new OleDbCommand(strSQL, dbConn);
dCmd.Parameters.AddWithValue("@AnteNum", OleDbType.Char).Value = fileid;
LabelFileNum.Text = LabelFileNum.Text + " " +
dCmd.ExecuteScalar().ToString();
I get the error "No value given for one or more required parameters."
Any suggestions ? This similar code worked in asp.net 1.1
Thanks,
Jim