G
Guest
I have a Winform news kiosk app which connects to a SQL database. When the
main form is running, it reaches a threshold time or number of sequential
operations and then loads another instance with a different dataset. The
datasets are based on local settings which I'm determining from IP space (all
machines running in that space will show the same news). The "special" set is
constructed at runtime so all important messages play in their entirty.
I keep getting the subject error on build. All functions work on their own,
but not as part of the form class. I don't see what I've done that will mess
it up. Here's the function to get the critical data. BTW, the ShortIPName
returns the first 3 segments of a machine's IP address.
string GetCommandText(string s)
{
try
{
string myIP = ShortIPName();
SqlConnection conn = new SqlConnection("Data Source=testSQL; Integrated
Security=SSPI;Initial Catalog=InfoScreens");
string scalarquery = "SELECT CmdCritical FROM Prefs WHERE IP = '" + myIP +
"'";
SqlCommand myCommand = new SqlCommand(scalarquery,conn);
myCommand.Connection.Open();
string rCommand = (string) myCommand.ExecuteScalar();
myCommand.Connection.Close();
return rCommand;
}
Thanks in advance,
E.
main form is running, it reaches a threshold time or number of sequential
operations and then loads another instance with a different dataset. The
datasets are based on local settings which I'm determining from IP space (all
machines running in that space will show the same news). The "special" set is
constructed at runtime so all important messages play in their entirty.
I keep getting the subject error on build. All functions work on their own,
but not as part of the form class. I don't see what I've done that will mess
it up. Here's the function to get the critical data. BTW, the ShortIPName
returns the first 3 segments of a machine's IP address.
string GetCommandText(string s)
{
try
{
string myIP = ShortIPName();
SqlConnection conn = new SqlConnection("Data Source=testSQL; Integrated
Security=SSPI;Initial Catalog=InfoScreens");
string scalarquery = "SELECT CmdCritical FROM Prefs WHERE IP = '" + myIP +
"'";
SqlCommand myCommand = new SqlCommand(scalarquery,conn);
myCommand.Connection.Open();
string rCommand = (string) myCommand.ExecuteScalar();
myCommand.Connection.Close();
return rCommand;
}
Thanks in advance,
E.