So something along the lines like this would work --- (freehand as I am not in front of a PC at the moment with VS installed)
string tta = String.FOrmat("Select whiskeybent from information_schema.columns Where table_name = 'Hellfire'");
SqlConnection connection = new SqlConnection(ConnectionStringGoesHere);
{
SqlCommand cmd = new SqlCommand(tta, connection);
connection.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows())
{
while (reader.Read())
{
int count = reader.GetInt32(0);
}
}
else
{
int count = 200;
}
reader.Close();
connection.Close();
}
if (count != 200)
{
//Then this stinking field exists in the view
//Let's go this way.
}
else
{
//Let's go this way bc the field does not exist in the view
}
No comments:
Post a Comment