changing the textbox values at the Run time

selvakumar_82

Member
Joined
Nov 29, 2005
Messages
6
Programming Experience
Beginner
Hi Friends,

I have 3 textboxes in a row 3 columns.

i want to insert all these values dynamically,instead of writing each textboxes values in a query .

cmd = New SqlCommand("Insert into Exchange_details values ('" & Invoice_No.Text & "','" & txtsno1.Text & "','" & txtfcamt5.Text & "','" & localrate5.Text & "',)", con)

each values are different datatypes.

I have created txtsno1,txtsno2,txtsno3 textboxes like these , i have to pass these values in a run time

any valuable suggestion really useful for me

Thanx and Regard
Selva.R
 
Most of them confused :

so i will explain my problem

or inserting 3 textboxes like 3 rows in the sense ,

I have 9 text boxes,, Like this s.no Item_code qty
1 2 3

4 5 6

7 8 9

I want to save all the values (from textboxes to database)

So i am using sql query :

cmd = New SqlCommand("Insert into Exchange_details values ('" & Invoice_No.Text & "','" & txtsno1.Text & "','" & txtfcamt1.Text & "','" & localrate1.Text & "',)", con)

what i need is , if i need to insert next row , i have to write one more query.

Instead of that just i will pass 2 instead of 1, So i will call the same query again and again

i dnt know how to write dynamic sql in this .............
 
What youre looking for is a parameterised query. VS2005 can create this for you or you can do it yourself the manual way.

THis article describes doing it yourself:
http://msdn.microsoft.com/library/d...html/cpconusingparameterswithdataadapters.asp

For having it done automatically (the IDE generates similar code to that found here) you need a DataSet and TableAdapter. Your code doesnt indicate you have these in your project, hence the reason I have not explained further
 
Back
Top