Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one stored procedure name "proc_function"

with three arguments

@u_id
@u_name
@u_ip


and now from c sharp i have to update my table by "proc_function"

here is the code which i wrote it but i don't know what to do next to

update my table

sql_string = ("Data Source=23423423423;Initial Catalog=sdfgsdf;User Id=dsfsdsa;Password=sdfsdf;");
 SqlConnection conn = new SqlConnection(sql_string);
 SqlCommand command = new SqlCommand("proc_function", conn);
 conn.Open();
 command.CommandType = CommandType.StoredProcedure;
 command.Parameters.AddWithValue("@usd", u_id);
 command.Parameters.AddWithValue("@uname", u_name );
 command.Parameters.AddWithValue("@uip", local_ip);


what to do next ...............
Posted
Updated 16-Jul-11 21:35pm
v2

1 solution

Write this below your code. It should then work.

command.ExecuteNonQuery();
command.Dispose();
conn.Close();
 
Share this answer
 
Comments
kami124 17-Jul-11 3:42am    
no, its still not working
what to do
walterhevedeich 17-Jul-11 3:51am    
Dont just say its not working. Instead, specify the error messages you are getting, if any. A statement like 'its not working' without any details wont bring you much help.
kami124 17-Jul-11 4:02am    
here is the error
execute a transact SQL statements against the connection and returns the number of rows effected
Uday P.Singh 17-Jul-11 4:51am    
Its not an error message: this is the description what ExecuteNonQuery() does. Post your error message or you can take the screenshot when error occurs and post that screenshot, then we can help you properly
RaisKazi 17-Jul-11 4:54am    
Agree with Uday.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900