Fellow coders,
I’m using an ADODB command to pull some information out of a database, which consists of several fields. However, when I run the code, it only ever pulls out one field, and it’s always the same one. I’m using MoveNext properly as far as I can tell, and I’m nested within an EOF while loop.
Here’s what I’ve got so far:
if (!rsStbDetails.EOF)
{
while (!rsStbDetails.EOF)
{
foreach (ADODB.Field f in rsStbDetails.Fields)
{
if (f.Value == null)
{
f.Value = 0;
}
switch (f.Name)
{
// There's a load of case statements here to manipulate the values being read in
default:
SetValue(id, f.Name, f.Value, f.Position);
break;
}
}
}
rsStbDetails.MoveNext();
}
Any ideas?
Cheers
EDIT: Here’s the code I’m using to set up my connection:
objComm.ActiveConnection = conSQL;
objComm.CommandType = CommandTypeEnum.adCmdStoredProc;
objComm.CommandText = "Service.GetDetails";
objComm.Parameters.Append(objComm.CreateParameter("@Node", ADODB.DataTypeEnum.adVarChar, ParameterDirectionEnum.adParamInput, 50, "NAME"));
objComm.Parameters.Append(objComm.CreateParameter("@Box", ADODB.DataTypeEnum.adVarChar, ParameterDirectionEnum.adParamInput, 20, ""));
objComm.Parameters.Append(objComm.CreateParameter("@Num", ADODB.DataTypeEnum.adInteger, ParameterDirectionEnum.adParamInput, 20, 0));
objComm.Parameters.Append(objComm.CreateParameter("@Exclude", ADODB.DataTypeEnum.adInteger, ParameterDirectionEnum.adParamInput, 20, iExclude));
objComm.Parameters[1].Value = Right((string)GetProperty(id, "SName", role), 8);
You should at least move
rsStbDetails.MoveNext();one brace up 🙂