473,958 Members | 52,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Execute stored procedures

14 New Member
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.CommandT ype = CommandType.Sto redProcedure;
mysql1.Connecti on = coon;
mysql1.Paramete rs.Add(new SqlParameter("@ Flowrate", Flowrate));
mysql1.Paramete rs.Add(new SqlParameter("@ SpecificVelocit y", SpecificVelocit y));
mysql1.Paramete rs.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 1294
shweta123
692 Recognized Expert Contributor
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.w ebcontrols textbox name=system.web .ui.webcontrols .textbox()
Mar 5 '07 #2
anniejacob
14 New Member
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.w ebcontrols textbox name=system.web .ui.webcontrols .textbox()


im using a windows application .
i created textboxes using

TextBox textboxes = new TextBox();
this.Controls.A dd(textboxes);

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

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

this.Controls.A dd(textboxes);

SqlCommand mysql1 = new SqlCommand("usp _calDiameter", coon);
mysql1.CommandT ype = CommandType.Sto redProcedure;
mysql1.Connecti on = coon;


'Assign value of textbox in a parameter

Dim p1 as new SqlParameter
p1.Value=this.c ontrols(""textb ox1").Text
............... ........
............... ......
mysql1.Paramete rs.Add(p1)
Mar 5 '07 #4
anniejacob
14 New Member
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.c ontrols(""textb ox1").Text
............... ........
............... ......
mysql1.Paramete rs.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 Recognized Expert Contributor
Hi,

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

for i=0 to me.controls.cou nt
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
6695
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 USENET...get rewarded for it!
1
1671
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 procedures that do selects.
5
3500
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 Procedures. I thought stored pricedures were an Oracle/MS SQL Server thing and don't know how they work with Access Jet. I've looked at some of the help on stored procedures in A2003, but really don't understand what's going on. Can someone...
2
3346
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 several stored procedures to Insert and update datas in our SQL database. Some stored procedures are smaller (insert datas in only one table) and some of them are quite big (insert datas in several
8
9575
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 : _____ System.Data.SqlClient.SqlException: EXECUTE permission denied on object 'CreateAccount', database 'wizou', schema 'dbo'. at
7
3230
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, …? Thanks, Jim.
0
2343
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 & _ " WHERE (((IDU) Like 'czz*' Or (IDU) Like 'cam*' Or (IDU) _ Like 'szz*' Or (IDU) Like 'J*' Or (IDU) Like 'G*' Or (IDU) _ Like 'U*'))" & " ORDER BY IDU;"
1
2954
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 written a few stored procedures but havent used prepare and execute.
7
25596
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 the list of my stored procedures, but I can not locate any permissions screen. Can someone help point me in the right direction? Thanks!
0
10074
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10793
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9998
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8370
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6305
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3656
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.