sending arraylist, sql contents, to database

Joined
Apr 14, 2005
Messages
2
Programming Experience
1-3
ok here is my code
Inherits System.Windows.Forms.Form

Shared connDB2 AsString

Public dv1 AsNew DataView

Public bmComps As BindingManagerBase

Dim dvCount, dvCurrent AsInteger

Dim dsorder AsNew DataSet

Dim dvorder AsNew DataView

Dim dh AsNew DataHandler

Dim updateStr AsString

Dim updateArray AsNew ArrayList

PublicSub MakeConnection()

connDB2 = "Provider=IBMDADB2.1;mode=readwrite;User ID=DB2051;Data Source=DB2051;persist security info=True;password=U83YX$"

EndSub

PrivateSub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click

MakeConnection()

Try

Dim panprice AsInteger

Dim totpanprice AsInteger

'Dim pancakeUpdate As String

Dim sqlselect AsString = "Select ITEMCHARGE from Menu WHERE NAME = 'Pancakes';"

panprice = dh.MySQLSelScalar(sqlselect, connDB2)

txt1a.Text =
CInt(txt1a.Text) + 1

totpanprice =
CInt(txt1a.Text) * CDec(panprice)

txt1b.Text =
CStr(totpanprice)

updateArray.Add("UPDATE Ingredient Set IngQty = Ingqty-2 Where IngItem = 1;")

updateArray.Add("UPDATE Ingredient Set IngQty = Ingqty-1 Where IngItem = 2;")

updateArray.Add("UPDATE Ingredient Set IngQty = Ingqty-2 Where IngItem = 3;")

updateArray.Add("UPDATE Ingredient Set IngQty = Ingqty-1 Where IngItem = 4;")

updateArray.Add("UPDATE Ingredient Set IngQty = Ingqty-1 Where IngItem = 5;")

updateArray.Add("UPDATE Ingredient Set IngQty = Ingqty-1 Where IngItem = 6;")



Catch ex As Exception

MessageBox.Show(ex.Message.ToString)

EndTry

EndSub

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

Try

Dim SendTran AsString

SendTran = updateStr

SendTran = "'" & SendTran & "'"

Dim sqlselect AsString = SendTran

dh.ExecuteSQL(sqlselect, connDB2)

Catch ax As Exception

MessageBox.Show(ax.Message.ToString)

EndTry

EndSub

what i am tryin to do is have it where everytime i click the pancake button it adds those sql statement to an arraylist (or if just a variable would work better thats fine just tell me) and i will actually have that code under a lot of buttons and they each update a different ingredient quantity...then when you click Button_1 it will finish the transaction and send all the proper sql to the database and update each ingredient quantity accordingly (to clarify i know i have updateStr where i want the contents of the array to be but it doesn't like me trying to turn an arraylist into a string


any help would be appreciated...thanks
russ
 
Back
Top