need advice

R

Ramin

Hi, I have 2 textboxses on asp.net page

textbox=description, textbox2=quantity



What I want when I enter values for them it stored temporarily or smth. like
that and then when I click order button it should submit it to SQL Server
(order, orderdetails)

it is like shopping basket bit without products. I enter products manually
(discription and quantity) and then click add. So I want to add many
orderdetails to single order



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click


SqlConnection1.Open()


SqlCommand1.CommandText = "NewOrder"

SqlCommand1.CommandType = CommandType.StoredProcedure

Dim p As New SqlClient.SqlParameter()

p.ParameterName = "@empID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = 1



SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "RETURN"

p.Direction = ParameterDirection.ReturnValue

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)

SqlCommand1.ExecuteScalar()



Dim RFID As Integer = CType(SqlCommand1.Parameters("RETURN").Value, Integer)

SqlCommand1.CommandText = "NewOrderLine"

SqlCommand1.CommandType = CommandType.StoredProcedure

SqlCommand1.Parameters.Clear()

p = New SqlClient.SqlParameter()

p.ParameterName = "@RFID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = RFID

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@Description"

p.Direction = ParameterDirection.Input

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@quantity"

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)


'add order

p = SqlCommand1.Parameters("@description")

p.Value = TextBox1.Text

p = SqlCommand1.Parameters("@quantity")

p.Value = TextBox3.Text

SqlCommand1.ExecuteNonQuery()



SqlConnection1.Close()

End Sub
 
R

Ramin

not yet

Alvin Bruney said:
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Ramin said:
Hi, I have 2 textboxses on asp.net page

textbox=description, textbox2=quantity



What I want when I enter values for them it stored temporarily or smth. like
that and then when I click order button it should submit it to SQL Server
(order, orderdetails)

it is like shopping basket bit without products. I enter products manually
(discription and quantity) and then click add. So I want to add many
orderdetails to single order



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click


SqlConnection1.Open()


SqlCommand1.CommandText = "NewOrder"

SqlCommand1.CommandType = CommandType.StoredProcedure

Dim p As New SqlClient.SqlParameter()

p.ParameterName = "@empID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = 1



SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "RETURN"

p.Direction = ParameterDirection.ReturnValue

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)

SqlCommand1.ExecuteScalar()



Dim RFID As Integer = CType(SqlCommand1.Parameters("RETURN").Value, Integer)

SqlCommand1.CommandText = "NewOrderLine"

SqlCommand1.CommandType = CommandType.StoredProcedure

SqlCommand1.Parameters.Clear()

p = New SqlClient.SqlParameter()

p.ParameterName = "@RFID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = RFID

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@Description"

p.Direction = ParameterDirection.Input

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@quantity"

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)


'add order

p = SqlCommand1.Parameters("@description")

p.Value = TextBox1.Text

p = SqlCommand1.Parameters("@quantity")

p.Value = TextBox3.Text

SqlCommand1.ExecuteNonQuery()



SqlConnection1.Close()

End Sub
 
A

Alvin Bruney [MVP]

If i understand you correctly, the best way forward would be to have a
submit button. This button takes the input of the text boxes and stores it
in an arraylist so the user can keep on submitting. When they are done, use
another button to loop thru the array list of items building the parameters
for the query. See if that helps.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Ramin said:
not yet

Alvin Bruney said:
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Ramin said:
Hi, I have 2 textboxses on asp.net page

textbox=description, textbox2=quantity



What I want when I enter values for them it stored temporarily or
smth.
like
that and then when I click order button it should submit it to SQL Server
(order, orderdetails)

it is like shopping basket bit without products. I enter products manually
(discription and quantity) and then click add. So I want to add many
orderdetails to single order



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click


SqlConnection1.Open()


SqlCommand1.CommandText = "NewOrder"

SqlCommand1.CommandType = CommandType.StoredProcedure

Dim p As New SqlClient.SqlParameter()

p.ParameterName = "@empID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = 1



SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "RETURN"

p.Direction = ParameterDirection.ReturnValue

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)

SqlCommand1.ExecuteScalar()



Dim RFID As Integer = CType(SqlCommand1.Parameters("RETURN").Value, Integer)

SqlCommand1.CommandText = "NewOrderLine"

SqlCommand1.CommandType = CommandType.StoredProcedure

SqlCommand1.Parameters.Clear()

p = New SqlClient.SqlParameter()

p.ParameterName = "@RFID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = RFID

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@Description"

p.Direction = ParameterDirection.Input

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@quantity"

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)


'add order

p = SqlCommand1.Parameters("@description")

p.Value = TextBox1.Text

p = SqlCommand1.Parameters("@quantity")

p.Value = TextBox3.Text

SqlCommand1.ExecuteNonQuery()



SqlConnection1.Close()

End Sub
 
R

Ramin

Thanks Alvin,
Can you please give me small code example, if possible



Alvin Bruney said:
If i understand you correctly, the best way forward would be to have a
submit button. This button takes the input of the text boxes and stores it
in an arraylist so the user can keep on submitting. When they are done, use
another button to loop thru the array list of items building the parameters
for the query. See if that helps.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Ramin said:
not yet

Alvin Bruney said:
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Hi, I have 2 textboxses on asp.net page

textbox=description, textbox2=quantity



What I want when I enter values for them it stored temporarily or smth.
like
that and then when I click order button it should submit it to SQL Server
(order, orderdetails)

it is like shopping basket bit without products. I enter products manually
(discription and quantity) and then click add. So I want to add many
orderdetails to single order



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click


SqlConnection1.Open()


SqlCommand1.CommandText = "NewOrder"

SqlCommand1.CommandType = CommandType.StoredProcedure

Dim p As New SqlClient.SqlParameter()

p.ParameterName = "@empID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = 1



SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "RETURN"

p.Direction = ParameterDirection.ReturnValue

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)

SqlCommand1.ExecuteScalar()



Dim RFID As Integer = CType(SqlCommand1.Parameters("RETURN").Value,
Integer)

SqlCommand1.CommandText = "NewOrderLine"

SqlCommand1.CommandType = CommandType.StoredProcedure

SqlCommand1.Parameters.Clear()

p = New SqlClient.SqlParameter()

p.ParameterName = "@RFID"

p.Direction = ParameterDirection.Input

p.SqlDbType = SqlDbType.Int

p.Value = RFID

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@Description"

p.Direction = ParameterDirection.Input

SqlCommand1.Parameters.Add(p)

p = New SqlClient.SqlParameter()

p.ParameterName = "@quantity"

p.SqlDbType = SqlDbType.Int

SqlCommand1.Parameters.Add(p)


'add order

p = SqlCommand1.Parameters("@description")

p.Value = TextBox1.Text

p = SqlCommand1.Parameters("@quantity")

p.Value = TextBox3.Text

SqlCommand1.ExecuteNonQuery()



SqlConnection1.Close()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top