Reputation: 85
I have created a Windows Forms and have a grid on it that I am trying to populate with the data below that returns from proc Get_Details on Sybase.
But I am getting the errors below for each of the fields, when I try to refer to them in the method FillScreen().
The type or namespace name '_PrId' could not be found (are you missing a directive or an assembly reference?) The type or namespace name '_DoId' could not be found (are you missing a directive or an assembly reference?) The type or namespace name '_Sta' could not be found (are you missing a directive or an assembly reference?) The type or namespace name '_PlId' could not be found (are you missing a directive or an assembly reference?) The type or namespace name '_TRequest' could not be found (are you missing a directive or an assembly reference?)
I know I could the method FillScreen() in another class and call it that way but just wondering is it possible to do it the way I am trying all in the same class.
Any more details/info needed pls let me know.
void CheckForJob(DateTime startDate)
{
bool closeConnection = false;
AseConnection con = null;
try
{
con = DatabaseUtil.GetCon();
if (con.Transaction == null)
closeConnection = true;
int _PrId;
int _DoId;
int _Sta;
int _PlId;
DateTime _TRequest;
using (var sqlCmd = new AseCommand("Get_Details", con))
{
sqlCmd.Parameters.Add("@Timerequested", AseDbType.DateTime).Value = startDate;
DataSet dataset;
DatabaseUtil.FetchData(sqlCmd, out dataset, con);
if (dataset.Tables.Count > 0)
{
foreach (DataRow tmpRow in dataset.Tables[0].Rows)
{
_PrId = (int)tmpRow["PR_ID"];
_DoId = (int)tmpRow["DO_ID"];
_Sta = (short)tmpRow["STA"];
_PlId = (int)tmpRow["PL_ID"];
_TRequest = (DateTime)tmpRow["T_REQUEST"];
FillScreen(_PrId, _DoId, _Sta, _PlId, _TRequest);
}
}
}
if (closeConnection) con.Close();
}
catch (Exception ex)
{
log.Error("Failed getting details from Get_Details", ex);
}
}
public void FillScreen(int _PrId, int _DoId, int _Sta, int _PlId, DateTime _TRequest);
{
object[] aRow = new object[5];
aRow[0] = _PrId;
aRow[1] = _DoId;
aRow[2] = _Sta;
aRow[3] = _PlId;
aRow[4] = Convert.ToDateTime(__TRequest).ToString("dd MMM yyyy");
grdDocs.Rows.Add(aRow);
}
Upvotes: 0
Views: 70
Reputation: 568
remove the semicolon in your function
public void FillScreen(int _PrId, int _DoId, int _Sta, int _PlId, DateTime _TRequest);
{.....
Upvotes: 2