473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Execute stored procedures

Hi,
i have made a dynamic form in C# where in the textboxes r made dynamically .
so now i have too run some stored procedures.
normally when u write code for the textboxes associated with it as

SqlCommand mysql1 = new SqlCommand("usp_calDiameter", coon);
mysql1.CommandType = CommandType.StoredProcedure;
mysql1.Connection = coon;
mysql1.Parameters.Add(new SqlParameter("@Flowrate", Flowrate));
mysql1.Parameters.Add(new SqlParameter("@SpecificVelocity", SpecificVelocity));
mysql1.Parameters.Add(new SqlParameter("@PSFID", PSFID));


but the prob is that im makin textboxes dynamically so if anyone could help me with the code to execute stored procedures using this dynamic textboxes


hope u people could help me out soon


Bye........
Mar 5 '07 #1
5 1277
shweta123
692 Expert 512MB
Hi,

How are you creating the textbox dynamically? If you will create it like this
you will be able to access its value

system.web.ui.webcontrols textbox name=system.web.ui.webcontrols.textbox()
Mar 5 '07 #2
Hi,

How are you creating the textbox dynamically? If you will create it like this
you will be able to access its value

system.web.ui.webcontrols textbox name=system.web.ui.webcontrols.textbox()


im using a windows application .
i created textboxes using

TextBox textboxes = new TextBox();
this.Controls.Add(textboxes);

can u help me to execute the stored procedures further
Mar 5 '07 #3
shweta123
692 Expert 512MB
Hi,

TextBox textboxes = new TextBox();
textboxes.Name = "textbox1"

this.Controls.Add(textboxes);

SqlCommand mysql1 = new SqlCommand("usp_calDiameter", coon);
mysql1.CommandType = CommandType.StoredProcedure;
mysql1.Connection = coon;


'Assign value of textbox in a parameter

Dim p1 as new SqlParameter
p1.Value=this.controls(""textbox1").Text
.......................
.....................
mysql1.Parameters.Add(p1)
Mar 5 '07 #4
hi,
in the last post u had given the code as
'Assign value of textbox in a parameter

Dim p1 as new SqlParameter
p1.Value=this.controls(""textbox1").Text
.......................
.....................
mysql1.Parameters.Add(p1)


but then im makin dynamic textboxes so then how 2 pass parameters 4 each.
so then i will have to use some general statement that will take all the parameters 4 as many textboxes present on that form.


In the form im makin, i have to pass some input values that will execute some stored procedures n will give out the output in the same form in textboxes


so i have many stored procedures also that is to b executed in the same form which will calculate the values 4 the textboxes.

so can anyone help me sort it out.
Mar 6 '07 #5
shweta123
692 Expert 512MB
Hi,

If "textbox1" is one of your textboxes.You can check for it as

for i=0 to me.controls.count
if me.controls(i).Name = ""textbox1" then
'Assign it to the paramter
p1.value= me.controls(i).Text
end if
next
Mar 7 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: salil bhole | last post by:
How do you use sqldmo object to execute system stored procedures? Any suggestions would be appreciated. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in...
1
by: HD | last post by:
Is there a way to let an account have execute permission on a stored procedure but not let that stored procedure run insert , delete, or update records. Basically only let them run or create stored...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
8
by: Jiggaz | last post by:
Hi, In my ASPX Page, i have a form for signup. And whene user click on the button, the event Button1_Click must use a stored procedure. But instead of use stored proc, i get this exception :...
7
by: JIM.H. | last post by:
Hello, Is there any difference to between SLQ string in the code and call execute query and call a stored procedure and execute the query that way concerning speed, effectiveness, reliability,...
0
by: franjorge | last post by:
Hi, I have created two stored procedures via VB using this code: sql = "CREATE PROC " & nombre_proc & " AS SELECT *" & _ " From MBM_PUNTOS_SCE_SIN_COINCIDIR_SIEGE_FALTA_PM_NE_" & mes & _ "...
1
by: rAinDeEr | last post by:
Hi, I have started using DB2 UDB ESE v8.2 in Linux recently. I have seen a lot of articles on packages, prepare statement, bind and execute statement. I havent got a clear idea. I have...
7
by: alvinstraight38 | last post by:
Hey guys, I'm pretty new to SQL configuration, and I need to give EXECUTE persmissions for one of the SQL user roles. I am running SQL 2005 Management Studio Express - free version. I found...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.