Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to update sql database table record using stored procedure.
Condition-
1.pass database name as a parameter
2.pass the table update where condition as a parameter

Thanks in advance!
Please help me as soon as possible
Posted

Now there is a novelty!

How do you propose to store this procedure? In which database? Because unless you put it in them all, you can't access it to select the database name...

Why are you trying to do this? What problem are you trying to solve that you think this will be a good idea?
 
Share this answer
 
Okay: first you would need to add the database name to the connection string you use (plus any other specific data like user name and password). You wouldn't want to do this every time unless you were trying to access multiple databases: even then you might want to store these in a config file and access as required. I'm sure you can do the research required to figure this out.

Second, if you have a stored procedure like (very simplistic):

SQL
create procedure UpdateWhatever (@Param1 int, @Param2 nvarchar(50))
as
    update table foo
    set Col1 = @Param2
    where Col2 = @param1
go


your program would pass the required parameters to the stored procedure using whatever method you deemed appropriate: again, do your research: I have no idea if you are using ADO or EF or whatever so hard to say how you should pass the data.

ps: Never say 'as soon as possible' or 'plz hlp': just pisses people off.
 
Share this answer
 

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