| Author |
Topic  |
|
|
Abid
Yak Posting Veteran
Pakistan
85 Posts |
Posted - 03/07/2013 : 08:28:38
|
Can i insert multiple records in SQL Server 2005 with single insert statement, by using vb.net.
On my vb.net ProdInfo form i have 12 textbox in 3 rows, (4 txtbox in each row) 4x3, which will be filled by the user and press the Submit button and all the 4 records will be inserted into Database. Is it possible? Please guide me. |
|
|
James K
Flowing Fount of Yak Knowledge
1709 Posts |
Posted - 03/07/2013 : 09:52:26
|
Yes, you can insert all of those 12 in a single insert statement, assuming they are all going into a single table. What you will need to do is to send them to the server as parameters of a stored procedure and have the stored procedure insert the values into the table.
There are other variations of that as well, but doing it the way I described above is perhaps the simplest. Google for some sample code or tutorials - here is one, for example: http://msdn.microsoft.com/en-us/library/yy6y35y8(v=vs.71).aspx |
 |
|
|
Abid
Yak Posting Veteran
Pakistan
85 Posts |
Posted - 03/07/2013 : 22:56:34
|
@ James K Thank you sir, but i've never used Stored Procedure in my programming. Please guide me further that how do i do it. my project is pending for this one thing only. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47960 Posts |
|
|
Abid
Yak Posting Veteran
Pakistan
85 Posts |
Posted - 03/08/2013 : 01:10:27
|
| very well visakh, i've now learned a bit that how to create store procedure. But now as my problem is concerned. I will declare variables in stored procedure, which will receive the values from vb.net, which i will send by textboxes or comboboxes etc. right? Am i right with this concept? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47960 Posts |
Posted - 03/08/2013 : 01:13:16
|
quote: Originally posted by Abid
very well visakh, i've now learned a bit that how to create store procedure. But now as my problem is concerned. I will declare variables in stored procedure, which will receive the values from vb.net, which i will send by textboxes or comboboxes etc. right? Am i right with this concept?
Yep you're right
But they're called parameters and not variables. They can be used to return values to calling application (vb.net) as well.
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
Abid
Yak Posting Veteran
Pakistan
85 Posts |
Posted - 03/18/2013 : 11:46:28
|
| Hi Everyone. my problem is solved. Thank you very much to all of you, who participated me with this problem. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47960 Posts |
Posted - 03/18/2013 : 12:53:41
|
you're welcome
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
Abid
Yak Posting Veteran
Pakistan
85 Posts |
Posted - 03/19/2013 : 08:47:22
|
| Thank you very much visakh16. |
 |
|
| |
Topic  |
|