sql Could not be resolved in current scope or context
Posted: Thu 27 May 2010 15:21
I'm trying to use sql to get the next value in a sequence. I've tried it both with dual and with another table I know exists that I have in my model as a an actual table. I've tried it both with TYC_DATA and without it. If I log into TOAD with the user Id and password then I can execute these commands directly. I'm probably missing something small but any help?
Connection string (modified the IP)
user id=TYC_DATA;password=********;server=1.1.1.1;home=oraodac11g_home1;direct=True;sid=CMCPPRL;persist security info=True
error message is
{"'TYC_DATA.pharmacy_order_detail' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near multipart identifier, line 1, column 23."}
Connection string (modified the IP)
user id=TYC_DATA;password=********;server=1.1.1.1;home=oraodac11g_home1;direct=True;sid=CMCPPRL;persist security info=True
Code: Select all
try
{
// Create the command.
System.Data.Common.DbCommand command = entities.Connection.CreateCommand();
//command.CommandText = "SELECT PATIENT_MEDICATION_SEQ.NEXTVAL FROM TYC_DATA.DUAL";
command.CommandText = "select detail_id from TYC_DATA.pharmacy_order_detail where detail_id = 10091666";
command.CommandType = CommandType.Text;
// Open the connection.
entities.Connection.Open();
// Retrieve the data.
string s = (string)command.ExecuteScalar();
// System.Data.Common.DbDataReader reader = command.ExecuteReader();
//while (reader.Read())
//{
// NextValue = Convert.ToInt32(reader[0]);
//}
}
catch (Exception ex)
{
Console.WriteLine("Exception.Message: {0}", ex.Message);
}
{"'TYC_DATA.pharmacy_order_detail' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near multipart identifier, line 1, column 23."}