Home > database >  System. Exception: "" @ rdID" near the grammatical mistakes. You must declare the sca
System. Exception: "" @ rdID" near the grammatical mistakes. You must declare the sca

Time:09-29

 
Public static DataTable GetDataTable (string SQL, SqlParameter [] the parameters, the string TableName)
{
The DataTable dt=null;
Try
{
OpenConn ();
SqlCommand CMD=new SqlCommand (SQL, conn);
If (the parameters.=null)
{
Foreach (SqlParameter parameter in the parameters)
{
CMD. The Parameters. The Add (parameter);
}
}
SqlDataAdapter sda=new SqlDataAdapter (CMD);
The DataSet ds=new DataSet ();
Sda. The Fill (ds, TableName);//connect database with data sets, fill the table to the dataset
Dt=ds. Tables [0];
}



Public static DataRow GetDRByID (int rdID)
{
# region by book number ID (bkID) to get the reader type information, return DataRow return DataTbel line
String SQL="select * from TB_Reader where rdID=@ rdID";
SqlParameter [] sqlParameters={new SqlParameter (" @ rdID rdID)};
The DataTable dt=null;
Dt=SqlHelper. GetDataTable (SQL, sqlParameters, "TB_Reader");
DataRow Dr=null;
If (dt==null | | dt. Rows. Count==0)
{
The return of Dr;
}
The else
{
Dr=dt. Rows [0];
The return of Dr;

}
# endregion
}
Public static Reader GetobjctByID (int rdID)
{
DataRow Dr=GetDRByID (rdID);
Return SqlHelper. DataRowToT (Dr);
}
}
}









  • Related