General information
Category:
Coding, syntax and commands
Title:
Invalid Object Name
I am getting an invalid object name when trying to select out of a Temporary table:
Code Is:
string sSQL4;
sSQL4 =
"SELECT FIELD12,AcNum,Delref into #Tempy1 FROM BI.dbo.BI01 WHERE SUBSTRING(STGROUP, 1, 2) = " +
textGroup.Text +
" AND (PERIOD = " + TextPeriodFrom.Text + ")" +
"GROUP BY FIELD12,AcNum,Delref ";
OleDbCommand cmdCount = new OleDbCommand(sSQL4, conn);
OleDbDataReader rdrCount = cmdCount.ExecuteReader();
string sSQL5;
sSQL5 =
"SELECT Field12,Count(FIELD12) as MyCount from #Tempy1 group by Field12 ";
OleDbCommand cmdCount2 = new OleDbCommand(sSQL5, conn);
OleDbDataReader rdrCount2 = cmdCount2.ExecuteReader();
The rdrCount2 gives the error when executing. Also Tried ##Tempy1 ..same error
TIA
Gerard
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only