|
I don't write in c-sharp, but vb is my thing, but I did my best to rewrite the function in how I think it should be written. The catch will tell you what's wrong with your function or TSQL.
Also it's best practice to package everything first, then open the database, execute, and close the database all in 1 shot.
I can't test your TSQL, in my tester program, that would take another 20 minutes for me.
exitCode int = 2;
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_command = new MySqlCommand("sp_delete_channel", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
param_Channel_ID SqlParameter = new SqlParameter("@param_channel_id", SqlDbType.Int);
param_Channel_ID.Value = channel_id;
sql_command.Add(param_Channel_ID);
param_Member_ID SqlParameter = new SqlParameter("@param_volow_member_id", SqlDbType.Int);
param_Member_ID.Value = Convert.ToInt32(Session["volow_member_id"]);
sql_command.Add(param_Memeber_ID);
param_Created SqlParameter = new SqlParameter("@param_is_channel_created", SqlDbType.Bit);
param_Created.Value = Convert.ToBoolean(ParameterDirection.Output);
sql_command.Add(param_Created_ID);
try {
sql_connection.Open();
sql_reader SqlDataReader = sql_command.ExecuteReader();
sql_command.ExecuteNonQuery();
sql_reader.Close();
sql_connection.Close();
exitCode = 0
}
catch ex as SQLException {
exitCode = 1
}
return exitCode;
BEGIN
SET param_is_channel_created = TRUE;
DELETE FROM member_posts WHERE member_channel_id=@param_channel_id;
DELETE FROM member_channels WHERE member_channel_id=@param_channel_id;
IF NOT EXISTS (SELECT member_channel_id FROM member_channels WHERE volow_member_id=@param_volow_member_id) THEN
BEGIN
SET param_is_channel_created = FALSE;
UPDATE volow_members SET is_channel_created=param_is_channel_created;
END;
END IF;
END
|
|
|
|
|
thanks for the reply
but the problem is my code is not throwing any exception error as if everything is normal and it's not doing what is should do (deleting the record)!!
|
|
|
|
|
May be your gridview data is not refreshing because of the dataset , please check, and Is this deleted from the database?
|
|
|
|
|
Please check the value of "int result_rows" also at first glance it seems that "IF NOT EXISTS" part wont be executed atall returning always "param_is_channel_created = TRUE"
|
|
|
|
|
there is datagrid VijayChauhan123
Sunil: the DELETE is before the IF NOT EXIST so it should have been invoked.
|
|
|
|
|
I even tried this simple delete but still not working:
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_command = new MySqlCommand("sp_delete_channel", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_connection.Open();
sql_command.Parameters.AddWithValue("param_channel_id", channel_id).MySqlDbType = MySqlDbType.Int32;
int result_row = sql_command.ExecuteNonQuery();
and SQL:
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_delete_channel`(IN param_channel_id int, IN param_volow_member_id int, OUT param_is_channel_created bit)
BEGIN
DELETE FROM member_posts WHERE member_channel_id = param_channel_id;
DELETE FROM member_channels WHERE member_channel_id = param_channel_id;
IF NOT EXISTS (SELECT member_channel_id FROM member_channels WHERE volow_member_id = param_volow_member_id) THEN
BEGIN
UPDATE volow_members SET is_channel_created = FALSE;
SET param_is_channel_created = FALSE;
END;
ELSE SET param_is_channel_created = TRUE;
END IF;
END
|
|
|
|
|
I even tried this simple delete but still not working. No error and records not getting deleted!!!
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_command = new MySqlCommand("sp_delete_channel", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_connection.Open();
sql_command.Parameters.AddWithValue("param_channel_id", channel_id).MySqlDbType = MySqlDbType.Int32;
int result_row = sql_command.ExecuteNonQuery();
and SQL:
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_delete_channel`(IN param_channel_id int, IN param_volow_member_id int, OUT param_is_channel_created bit)
BEGIN
DELETE FROM member_posts WHERE member_channel_id = param_channel_id;
DELETE FROM member_channels WHERE member_channel_id = param_channel_id;
IF NOT EXISTS (SELECT member_channel_id FROM member_channels WHERE volow_member_id = param_volow_member_id) THEN
BEGIN
UPDATE volow_members SET is_channel_created = FALSE;
SET param_is_channel_created = FALSE;
END;
ELSE SET param_is_channel_created = TRUE;
END IF;
END
|
|
|
|
|
Can you check if the SP itself works as expected by passing parameters (from ssms itself)
|
|
|
|
|
How to Develop asp.net application to control Time and authentication fingerprint Device such as get user ID from Device,enroll new user and act..
Thanks All...
|
|
|
|
|
You need to start with the manufacturer of the device. The vendor will have a programming guide or API that will allow you to communicate with the device. There is no industry standard for communicating to these devices.
|
|
|
|
|
After getting API of Device,what's the next step in programming and How can i deal with API in asp.net,because it is first time to deal with api in c# programming
THanks David...
|
|
|
|
|
There will be already developed dll's or functions, you can call them directly...
this is very interesting and very easy, once you jump into that you will feel cool.
|
|
|
|
|
HI
Is there any working solution for how to Run an URL inside a WCF webservice, the URL return a mp3/zip file.
and output of the web service also return those mp3/zip file with prompt "open/save" options in the browser.
my aim to be restrict End user not to know the actual download URL.
I am using below code, but this will not asking for prompt(open/save), i need to specify the path . it get faild if that path is not found any PC
ex: http://download.microsoft.com/download/C/9/4/C94B7FA8-E35F-4C96-8B35-7B183918298F/HDI_ITPro_MSDN_mp3_Installing_ASP_NET_and_Tools_v2.mp3
string remoteUri ="http://download.microsoft.com/download/C/9/4/C94B7FA8-E35F-4C96-8B35-7B183918298F/HDI_ITPro_MSDN_mp3_Installing_ASP_NET_and_Tools_v2.mp3";
string fileName = AppDomain.CurrentDomain.BaseDirectory +"\download\Tools_v2.mp3", myStringWebResource = null;
WebClient myWebClient2 = new WebClient();
myStringWebResource = remoteUri + fileName;
myWebClient2.DownloadFile(myStringWebResource, fileName);
|
|
|
|
|
how to bind menu from database in asp 2.0?
after this i want to display sub menu on the mouse hover in the menu items?
after this i want to display sub sub menu on the mouse hover on the sub menu items?
thanks in advance
|
|
|
|
|
|
|
How can i get value of user entered Description using jquery to use in Model.cs class
@Html.EditorFor(model => model.Description, null, "Description", null)
|
|
|
|
|
|
Hi..which software is best for recording screen videos with audio to make tutorials of programming examples...?
|
|
|
|
|
|
|
what is the use of deploying and setup of websites and when they are helpful?
pravn
|
|
|
|
|
Praveen Reddy(ganni) wrote: what is the use of deploying and setup of websites
This enables one to access the hosted website anywhere in the world using internet at any time.
|
|
|
|
|
3 types of SQL-cache dependencies exist:
a. Other cache items.
b. Files/folders.
c. Dependencies on a database query.
|
|
|
|
|
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Edit" link to edit your question and provide better information.
|
|
|
|