المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Passing SQL Statement --- What am I doing Wrong? ---



C# Programming
06-25-2009, 10:30 AM
All I want the procedure to do is execute the sql statement that I pass it. I do not want or need any result to be passed back as the stored procedures will update or or insert to the tables.



private void SQLExecution(string WhatismyConnectionString, string MySQLStatement)
{
//This is the command I am passing in the SQL Statement...
//It is a stored procedure that simply does a deletion to the table.
//WhatismyConnectionString = "sp_vc_NoLongerExist + @MachineName + @UserName + @AppName"

SqlConnection conn = new SqlConnection(WhatismyConnectionString);
SqlCommand command = conn.CreateCommand();
command.CommandText = MySQLStatement;

command.CommandType = CommandType.Text;

// execute the command that returns a SqlDataReader
object returnvalue = command.ExecuteScalar();


MessageBox.Show("YEA?");
}