訂單確認.vb 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. Imports System.Data.SqlClient
  2. Public Class 訂單確認
  3. Dim conn As New SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\奕穎\Documents\資管\大三上\系分\謎鹿\謎鹿.mdf;Integrated Security=True;Connect Timeout=30")
  4. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  5. 購物車.Show()
  6. Me.Visible = False
  7. End Sub
  8. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  9. '新增訂單
  10. conn.Open()
  11. Dim t As Date
  12. t = Today
  13. Dim m_訂單編號 = 耳環.Label6.Text + 耳環.Label20.Text
  14. Dim m_付款方式 = ComboBox1.Text
  15. Dim m_取貨方式 = ComboBox2.Text
  16. Dim m_訂單日期 = t
  17. Dim m_會員編號 = 耳環.Label6.Text
  18. Dim m_購物車編號 = 耳環.Label6.Text + "cart"
  19. Dim sqladd As String = "INSERT INTO 訂單(訂單編號,付款方式,取貨方式,訂單日期,會員編號,購物車編號) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text & "',N'" & ComboBox1.Text & "',N'" & ComboBox2.Text & "','" & t & "','" & 耳環.Label6.Text & "','" & 耳環.Label6.Text + "cart" & "')"
  20. Dim add = New SqlCommand(sqladd, conn)
  21. add.ExecuteNonQuery()
  22. 訂單.Show()
  23. Me.Visible = False
  24. MsgBox("購買成功!")
  25. conn.Close()
  26. Try
  27. Me.訂單TableAdapter.InsertQuery(m_訂單編號, m_付款方式, m_取貨方式, m_訂單日期, m_會員編號, m_購物車編號)
  28. Catch ex1 As Exception
  29. End Try
  30. Me.訂單DataGridView.Refresh()
  31. Me.訂單BindingSource.DataSource = 訂單TableAdapter.GetData()
  32. Me.訂單BindingSource.ResetBindings(False)
  33. '新增商品編號1紀錄
  34. conn.Open()
  35. Dim m_訂單編號1 = 耳環.Label6.Text + 耳環.Label20.Text + "a"
  36. Dim m_商品編號1 = 耳環.Label25.Text
  37. Dim m_訂購數量1 = 耳環.TextBox2.Text
  38. Dim m_價錢1 = 290 * Val(耳環.TextBox2.Text)
  39. Dim sqladd1 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "a" & "','" & 耳環.Label25.Text & "','" & 耳環.TextBox2.Text & "','" & 290 * Val(耳環.TextBox2.Text) & "')"
  40. Dim add1 = New SqlCommand(sqladd1, conn)
  41. add1.ExecuteNonQuery()
  42. Me.Visible = False
  43. conn.Close()
  44. Try
  45. Me.紀錄TableAdapter.InsertQuery(m_訂單編號1, m_商品編號1, m_訂購數量1, m_價錢1)
  46. Catch ex2 As Exception
  47. End Try
  48. Me.紀錄DataGridView.Refresh()
  49. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  50. Me.紀錄BindingSource.ResetBindings(False)
  51. '新增會員購買紀錄(商品編號1)
  52. conn.Open()
  53. Dim m_會員編號1 = 耳環.Label6.Text + "a" + 耳環.Label20.Text
  54. Dim m_商品編號1a = 耳環.Label25.Text
  55. Dim m_訂購數量1a = 耳環.TextBox2.Text
  56. Dim sqladd1a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "a" + 耳環.Label20.Text & "','" & 耳環.Label25.Text & "','" & 耳環.TextBox2.Text & "')"
  57. Dim add1a = New SqlCommand(sqladd1a, conn)
  58. add1a.ExecuteNonQuery()
  59. Me.Visible = False
  60. conn.Close()
  61. Try
  62. Me.訂購TableAdapter.InsertQuery(m_會員編號1, m_商品編號1a, m_訂購數量1a)
  63. Catch ex3 As Exception
  64. End Try
  65. Me.訂購DataGridView.Refresh()
  66. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  67. Me.訂購BindingSource.ResetBindings(False)
  68. '新增商品編號2紀錄
  69. conn.Open()
  70. Dim m_訂單編號2 = 耳環.Label6.Text + 耳環.Label20.Text + "b"
  71. Dim m_商品編號2 = 耳環.Label26.Text
  72. Dim m_訂購數量2 = 耳環.TextBox3.Text
  73. Dim m_價錢2 = 190 * Val(耳環.TextBox3.Text)
  74. Dim sqladd2 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "b" & "','" & 耳環.Label26.Text & "','" & 耳環.TextBox3.Text & "','" & 190 * Val(耳環.TextBox3.Text) & "')"
  75. Dim add2 = New SqlCommand(sqladd2, conn)
  76. add2.ExecuteNonQuery()
  77. Me.Visible = False
  78. conn.Close()
  79. Try
  80. Me.紀錄TableAdapter.InsertQuery(m_訂單編號2, m_商品編號2, m_訂購數量2, m_價錢2)
  81. Catch ex4 As Exception
  82. End Try
  83. Me.紀錄DataGridView.Refresh()
  84. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  85. Me.紀錄BindingSource.ResetBindings(False)
  86. '新增會員購買紀錄(商品編號2)
  87. conn.Open()
  88. Dim m_會員編號2 = 耳環.Label6.Text + "b" + 耳環.Label20.Text
  89. Dim m_商品編號2a = 耳環.Label26.Text
  90. Dim m_訂購數量2a = 耳環.TextBox3.Text
  91. Dim sqladd2a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "b" + 耳環.Label20.Text & "','" & 耳環.Label26.Text & "','" & 耳環.TextBox3.Text & "')"
  92. Dim add2a = New SqlCommand(sqladd2a, conn)
  93. add2a.ExecuteNonQuery()
  94. Me.Visible = False
  95. conn.Close()
  96. Try
  97. Me.訂購TableAdapter.InsertQuery(m_會員編號2, m_商品編號2a, m_訂購數量2a)
  98. Catch ex5 As Exception
  99. End Try
  100. Me.訂購DataGridView.Refresh()
  101. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  102. Me.訂購BindingSource.ResetBindings(False)
  103. '新增商品編號3紀錄
  104. conn.Open()
  105. Dim m_訂單編號3 = 耳環.Label6.Text + 耳環.Label20.Text + "c"
  106. Dim m_商品編號3 = 耳環.Label27.Text
  107. Dim m_訂購數量3 = 耳環.TextBox4.Text
  108. Dim m_價錢3 = 190 * Val(耳環.TextBox4.Text)
  109. Dim sqladd3 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "c" & "','" & 耳環.Label27.Text & "','" & 耳環.TextBox4.Text & "','" & 190 * Val(耳環.TextBox4.Text) & "')"
  110. Dim add3 = New SqlCommand(sqladd3, conn)
  111. add3.ExecuteNonQuery()
  112. Me.Visible = False
  113. conn.Close()
  114. Try
  115. Me.紀錄TableAdapter.InsertQuery(m_訂單編號3, m_商品編號3, m_訂購數量3, m_價錢3)
  116. Catch ex6 As Exception
  117. End Try
  118. Me.紀錄DataGridView.Refresh()
  119. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  120. Me.紀錄BindingSource.ResetBindings(False)
  121. '新增會員購買紀錄(商品編號3)
  122. conn.Open()
  123. Dim m_會員編號3 = 耳環.Label6.Text + "c" + 耳環.Label20.Text
  124. Dim m_商品編號3a = 耳環.Label27.Text
  125. Dim m_訂購數量3a = 耳環.TextBox4.Text
  126. Dim sqladd3a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "c" + 耳環.Label20.Text & "','" & 耳環.Label27.Text & "','" & 耳環.TextBox4.Text & "')"
  127. Dim add3a = New SqlCommand(sqladd3a, conn)
  128. add3a.ExecuteNonQuery()
  129. Me.Visible = False
  130. conn.Close()
  131. Try
  132. Me.訂購TableAdapter.InsertQuery(m_會員編號3, m_商品編號3a, m_訂購數量3a)
  133. Catch ex7 As Exception
  134. End Try
  135. Me.訂購DataGridView.Refresh()
  136. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  137. Me.訂購BindingSource.ResetBindings(False)
  138. '新增商品編號4紀錄
  139. conn.Open()
  140. Dim m_訂單編號4 = 耳環.Label6.Text + 耳環.Label20.Text + "d"
  141. Dim m_商品編號4 = 耳環.Label28.Text
  142. Dim m_訂購數量4 = 耳環.TextBox5.Text
  143. Dim m_價錢4 = 290 * Val(耳環.TextBox5.Text)
  144. Dim sqladd4 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "d" & "','" & 耳環.Label28.Text & "','" & 耳環.TextBox5.Text & "','" & 290 * Val(耳環.TextBox5.Text) & "')"
  145. Dim add4 = New SqlCommand(sqladd4, conn)
  146. add4.ExecuteNonQuery()
  147. Me.Visible = False
  148. conn.Close()
  149. Try
  150. Me.紀錄TableAdapter.InsertQuery(m_訂單編號4, m_商品編號4, m_訂購數量4, m_價錢4)
  151. Catch ex8 As Exception
  152. End Try
  153. Me.紀錄DataGridView.Refresh()
  154. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  155. Me.紀錄BindingSource.ResetBindings(False)
  156. '新增會員購買紀錄(商品編號4)
  157. conn.Open()
  158. Dim m_會員編號4 = 耳環.Label6.Text + "d" + 耳環.Label20.Text
  159. Dim m_商品編號4a = 耳環.Label28.Text
  160. Dim m_訂購數量4a = 耳環.TextBox5.Text
  161. Dim sqladd4a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "d" + 耳環.Label20.Text & "','" & 耳環.Label28.Text & "','" & 耳環.TextBox5.Text & "')"
  162. Dim add4a = New SqlCommand(sqladd4a, conn)
  163. add4a.ExecuteNonQuery()
  164. Me.Visible = False
  165. conn.Close()
  166. Try
  167. Me.訂購TableAdapter.InsertQuery(m_會員編號4, m_商品編號4a, m_訂購數量4a)
  168. Catch ex9 As Exception
  169. End Try
  170. Me.訂購DataGridView.Refresh()
  171. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  172. Me.訂購BindingSource.ResetBindings(False)
  173. '新增商品編號5紀錄
  174. conn.Open()
  175. Dim m_訂單編號5 = 耳環.Label6.Text + 耳環.Label20.Text + "e"
  176. Dim m_商品編號5 = 吊飾.Label12.Text
  177. Dim m_訂購數量5 = 吊飾.TextBox2.Text
  178. Dim m_價錢5 = 200 * Val(吊飾.TextBox2.Text)
  179. Dim sqladd5 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "e" & "','" & 吊飾.Label12.Text & "','" & 吊飾.TextBox2.Text & "','" & 200 * Val(吊飾.TextBox2.Text) & "')"
  180. Dim add5 = New SqlCommand(sqladd5, conn)
  181. add5.ExecuteNonQuery()
  182. Me.Visible = False
  183. conn.Close()
  184. Try
  185. Me.紀錄TableAdapter.InsertQuery(m_訂單編號5, m_商品編號5, m_訂購數量5, m_價錢5)
  186. Catch ex10 As Exception
  187. End Try
  188. Me.紀錄DataGridView.Refresh()
  189. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  190. Me.紀錄BindingSource.ResetBindings(False)
  191. '新增會員購買紀錄(商品編號5)
  192. conn.Open()
  193. Dim m_會員編號5 = 耳環.Label6.Text + "e" + 耳環.Label20.Text
  194. Dim m_商品編號5a = 吊飾.Label12.Text
  195. Dim m_訂購數量5a = 吊飾.TextBox2.Text
  196. Dim sqladd5a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "e" + 耳環.Label20.Text & "','" & 吊飾.Label12.Text & "','" & 吊飾.TextBox2.Text & "')"
  197. Dim add5a = New SqlCommand(sqladd5a, conn)
  198. add5a.ExecuteNonQuery()
  199. Me.Visible = False
  200. conn.Close()
  201. Try
  202. Me.訂購TableAdapter.InsertQuery(m_會員編號5, m_商品編號5a, m_訂購數量5a)
  203. Catch ex11 As Exception
  204. End Try
  205. Me.訂購DataGridView.Refresh()
  206. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  207. Me.訂購BindingSource.ResetBindings(False)
  208. '新增商品編號6紀錄
  209. conn.Open()
  210. Dim m_訂單編號6 = 耳環.Label6.Text + 耳環.Label20.Text + "f"
  211. Dim m_商品編號6 = 吊飾.Label13.Text
  212. Dim m_訂購數量6 = 吊飾.TextBox3.Text
  213. Dim m_價錢6 = 200 * Val(吊飾.TextBox3.Text)
  214. Dim sqladd6 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "f" & "','" & 吊飾.Label13.Text & "','" & 吊飾.TextBox3.Text & "','" & 200 * Val(吊飾.TextBox3.Text) & "')"
  215. Dim add6 = New SqlCommand(sqladd6, conn)
  216. add6.ExecuteNonQuery()
  217. Me.Visible = False
  218. conn.Close()
  219. Try
  220. Me.紀錄TableAdapter.InsertQuery(m_訂單編號6, m_商品編號6, m_訂購數量6, m_價錢6)
  221. Catch ex12 As Exception
  222. End Try
  223. Me.紀錄DataGridView.Refresh()
  224. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  225. Me.紀錄BindingSource.ResetBindings(False)
  226. '新增會員購買紀錄(商品編號6)
  227. conn.Open()
  228. Dim m_會員編號6 = 耳環.Label6.Text + "f" + 耳環.Label20.Text
  229. Dim m_商品編號6a = 吊飾.Label13.Text
  230. Dim m_訂購數量6a = 吊飾.TextBox3.Text
  231. Dim sqladd6a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "f" + 耳環.Label20.Text & "','" & 吊飾.Label13.Text & "','" & 吊飾.TextBox3.Text & "')"
  232. Dim add6a = New SqlCommand(sqladd6a, conn)
  233. add6a.ExecuteNonQuery()
  234. Me.Visible = False
  235. conn.Close()
  236. Try
  237. Me.訂購TableAdapter.InsertQuery(m_會員編號6, m_商品編號6a, m_訂購數量6a)
  238. Catch ex13 As Exception
  239. End Try
  240. Me.訂購DataGridView.Refresh()
  241. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  242. Me.訂購BindingSource.ResetBindings(False)
  243. '新增商品編號7紀錄
  244. conn.Open()
  245. Dim m_訂單編號7 = 耳環.Label6.Text + 耳環.Label20.Text + "g"
  246. Dim m_商品編號7 = 吊飾.Label14.Text
  247. Dim m_訂購數量7 = 吊飾.TextBox4.Text
  248. Dim m_價錢7 = 200 * Val(吊飾.TextBox4.Text)
  249. Dim sqladd7 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "g" & "','" & 吊飾.Label14.Text & "','" & 吊飾.TextBox4.Text & "','" & 200 * Val(吊飾.TextBox4.Text) & "')"
  250. Dim add7 = New SqlCommand(sqladd7, conn)
  251. add7.ExecuteNonQuery()
  252. Me.Visible = False
  253. conn.Close()
  254. Try
  255. Me.紀錄TableAdapter.InsertQuery(m_訂單編號7, m_商品編號7, m_訂購數量7, m_價錢7)
  256. Catch ex14 As Exception
  257. End Try
  258. Me.紀錄DataGridView.Refresh()
  259. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  260. Me.紀錄BindingSource.ResetBindings(False)
  261. '新增會員購買紀錄(商品編號7)
  262. conn.Open()
  263. Dim m_會員編號7 = 耳環.Label6.Text + "g" + 耳環.Label20.Text
  264. Dim m_商品編號7a = 吊飾.Label14.Text
  265. Dim m_訂購數量7a = 吊飾.TextBox4.Text
  266. Dim sqladd7a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "g" + 耳環.Label20.Text & "','" & 吊飾.Label14.Text & "','" & 吊飾.TextBox4.Text & "')"
  267. Dim add7a = New SqlCommand(sqladd7a, conn)
  268. add7a.ExecuteNonQuery()
  269. Me.Visible = False
  270. conn.Close()
  271. Try
  272. Me.訂購TableAdapter.InsertQuery(m_會員編號7, m_商品編號7a, m_訂購數量7a)
  273. Catch ex15 As Exception
  274. End Try
  275. Me.訂購DataGridView.Refresh()
  276. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  277. Me.訂購BindingSource.ResetBindings(False)
  278. '新增商品編號8紀錄
  279. conn.Open()
  280. Dim m_訂單編號8 = 耳環.Label6.Text + 耳環.Label20.Text + "h"
  281. Dim m_商品編號8 = 吊飾.Label15.Text
  282. Dim m_訂購數量8 = 吊飾.TextBox5.Text
  283. Dim m_價錢8 = 200 * Val(吊飾.TextBox5.Text)
  284. Dim sqladd8 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "h" & "','" & 吊飾.Label15.Text & "','" & 吊飾.TextBox5.Text & "','" & 200 * Val(吊飾.TextBox5.Text) & "')"
  285. Dim add8 = New SqlCommand(sqladd8, conn)
  286. add8.ExecuteNonQuery()
  287. Me.Visible = False
  288. conn.Close()
  289. Try
  290. Me.紀錄TableAdapter.InsertQuery(m_訂單編號8, m_商品編號8, m_訂購數量8, m_價錢8)
  291. Catch ex16 As Exception
  292. End Try
  293. Me.紀錄DataGridView.Refresh()
  294. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  295. Me.紀錄BindingSource.ResetBindings(False)
  296. '新增會員購買紀錄(商品編號8)
  297. conn.Open()
  298. Dim m_會員編號8 = 耳環.Label6.Text + "h" + 耳環.Label20.Text
  299. Dim m_商品編號8a = 吊飾.Label15.Text
  300. Dim m_訂購數量8a = 吊飾.TextBox5.Text
  301. Dim sqladd8a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "h" + 耳環.Label20.Text & "','" & 吊飾.Label15.Text & "','" & 吊飾.TextBox5.Text & "')"
  302. Dim add8a = New SqlCommand(sqladd8a, conn)
  303. add8a.ExecuteNonQuery()
  304. Me.Visible = False
  305. conn.Close()
  306. Try
  307. Me.訂購TableAdapter.InsertQuery(m_會員編號8, m_商品編號8a, m_訂購數量8a)
  308. Catch ex17 As Exception
  309. End Try
  310. Me.訂購DataGridView.Refresh()
  311. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  312. Me.訂購BindingSource.ResetBindings(False)
  313. '新增商品編號9紀錄
  314. conn.Open()
  315. Dim m_訂單編號9 = 耳環.Label6.Text + 耳環.Label20.Text + "i"
  316. Dim m_商品編號9 = 指甲油.Label12.Text
  317. Dim m_訂購數量9 = 指甲油.TextBox3.Text
  318. Dim m_價錢9 = 380 * Val(指甲油.TextBox3.Text)
  319. Dim sqladd9 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "i" & "','" & 指甲油.Label12.Text & "','" & 指甲油.TextBox3.Text & "','" & 380 * Val(指甲油.TextBox3.Text) & "')"
  320. Dim add9 = New SqlCommand(sqladd9, conn)
  321. add9.ExecuteNonQuery()
  322. Me.Visible = False
  323. conn.Close()
  324. Try
  325. Me.紀錄TableAdapter.InsertQuery(m_訂單編號9, m_商品編號9, m_訂購數量9, m_價錢9)
  326. Catch ex18 As Exception
  327. End Try
  328. Me.紀錄DataGridView.Refresh()
  329. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  330. Me.紀錄BindingSource.ResetBindings(False)
  331. '新增會員購買紀錄(商品編號9)
  332. conn.Open()
  333. Dim m_會員編號9 = 耳環.Label6.Text + "i" + 耳環.Label20.Text
  334. Dim m_商品編號9a = 指甲油.Label12.Text
  335. Dim m_訂購數量9a = 指甲油.TextBox3.Text
  336. Dim sqladd9a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "i" + 耳環.Label20.Text & "','" & 指甲油.Label12.Text & "','" & 指甲油.TextBox3.Text & "')"
  337. Dim add9a = New SqlCommand(sqladd9a, conn)
  338. add9a.ExecuteNonQuery()
  339. Me.Visible = False
  340. conn.Close()
  341. Try
  342. Me.訂購TableAdapter.InsertQuery(m_會員編號9, m_商品編號9a, m_訂購數量9a)
  343. Catch ex19 As Exception
  344. End Try
  345. Me.訂購DataGridView.Refresh()
  346. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  347. Me.訂購BindingSource.ResetBindings(False)
  348. '新增商品編號10紀錄
  349. conn.Open()
  350. Dim m_訂單編號10 = 耳環.Label6.Text + 耳環.Label20.Text + "j"
  351. Dim m_商品編號10 = 指甲油.Label13.Text
  352. Dim m_訂購數量10 = 指甲油.TextBox2.Text
  353. Dim m_價錢10 = 380 * Val(指甲油.TextBox2.Text)
  354. Dim sqladd10 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "j" & "','" & 指甲油.Label13.Text & "','" & 指甲油.TextBox2.Text & "','" & 380 * Val(指甲油.TextBox2.Text) & "')"
  355. Dim add10 = New SqlCommand(sqladd10, conn)
  356. add10.ExecuteNonQuery()
  357. Me.Visible = False
  358. conn.Close()
  359. Try
  360. Me.紀錄TableAdapter.InsertQuery(m_訂單編號10, m_商品編號10, m_訂購數量10, m_價錢10)
  361. Catch ex20 As Exception
  362. End Try
  363. Me.紀錄DataGridView.Refresh()
  364. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  365. Me.紀錄BindingSource.ResetBindings(False)
  366. '新增會員購買紀錄(商品編號10)
  367. conn.Open()
  368. Dim m_會員編號10 = 耳環.Label6.Text + "j" + 耳環.Label20.Text
  369. Dim m_商品編號10a = 指甲油.Label13.Text
  370. Dim m_訂購數量10a = 指甲油.TextBox2.Text
  371. Dim sqladd10a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "j" + 耳環.Label20.Text & "','" & 指甲油.Label13.Text & "','" & 指甲油.TextBox2.Text & "')"
  372. Dim add10a = New SqlCommand(sqladd10a, conn)
  373. add10a.ExecuteNonQuery()
  374. Me.Visible = False
  375. conn.Close()
  376. Try
  377. Me.訂購TableAdapter.InsertQuery(m_會員編號10, m_商品編號10a, m_訂購數量10a)
  378. Catch ex21 As Exception
  379. End Try
  380. Me.訂購DataGridView.Refresh()
  381. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  382. Me.訂購BindingSource.ResetBindings(False)
  383. '新增商品編號11紀錄
  384. conn.Open()
  385. Dim m_訂單編號11 = 耳環.Label6.Text + 耳環.Label20.Text + "k"
  386. Dim m_商品編號11 = 指甲油.Label14.Text
  387. Dim m_訂購數量11 = 指甲油.TextBox4.Text
  388. Dim m_價錢11 = 380 * Val(指甲油.TextBox4.Text)
  389. Dim sqladd11 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "k" & "','" & 指甲油.Label14.Text & "','" & 指甲油.TextBox4.Text & "','" & 380 * Val(指甲油.TextBox4.Text) & "')"
  390. Dim add11 = New SqlCommand(sqladd11, conn)
  391. add11.ExecuteNonQuery()
  392. Me.Visible = False
  393. conn.Close()
  394. Try
  395. Me.紀錄TableAdapter.InsertQuery(m_訂單編號11, m_商品編號11, m_訂購數量11, m_價錢11)
  396. Catch ex22 As Exception
  397. End Try
  398. Me.紀錄DataGridView.Refresh()
  399. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  400. Me.紀錄BindingSource.ResetBindings(False)
  401. '新增會員購買紀錄(商品編號11)
  402. conn.Open()
  403. Dim m_會員編號11 = 耳環.Label6.Text + "k" + 耳環.Label20.Text
  404. Dim m_商品編號11a = 指甲油.Label14.Text
  405. Dim m_訂購數量11a = 指甲油.TextBox4.Text
  406. Dim sqladd11a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "k" + 耳環.Label20.Text & "','" & 指甲油.Label14.Text & "','" & 指甲油.TextBox4.Text & "')"
  407. Dim add11a = New SqlCommand(sqladd11a, conn)
  408. add11a.ExecuteNonQuery()
  409. Me.Visible = False
  410. conn.Close()
  411. Try
  412. Me.訂購TableAdapter.InsertQuery(m_會員編號11, m_商品編號11a, m_訂購數量11a)
  413. Catch ex23 As Exception
  414. End Try
  415. Me.訂購DataGridView.Refresh()
  416. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  417. Me.訂購BindingSource.ResetBindings(False)
  418. '新增商品編號12紀錄
  419. conn.Open()
  420. Dim m_訂單編號12 = 耳環.Label6.Text + 耳環.Label20.Text + "l"
  421. Dim m_商品編號12 = 指甲油.Label15.Text
  422. Dim m_訂購數量12 = 指甲油.TextBox5.Text
  423. Dim m_價錢12 = 290 * Val(指甲油.TextBox5.Text)
  424. Dim sqladd12 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "l" & "','" & 指甲油.Label15.Text & "','" & 指甲油.TextBox5.Text & "','" & 290 * Val(指甲油.TextBox5.Text) & "')"
  425. Dim add12 = New SqlCommand(sqladd12, conn)
  426. add12.ExecuteNonQuery()
  427. Me.Visible = False
  428. conn.Close()
  429. Try
  430. Me.紀錄TableAdapter.InsertQuery(m_訂單編號12, m_商品編號12, m_訂購數量12, m_價錢12)
  431. Catch ex24 As Exception
  432. End Try
  433. Me.紀錄DataGridView.Refresh()
  434. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  435. Me.紀錄BindingSource.ResetBindings(False)
  436. '新增會員購買紀錄(商品編號12)
  437. conn.Open()
  438. Dim m_會員編號12 = 耳環.Label6.Text + "l" + 耳環.Label20.Text
  439. Dim m_商品編號12a = 指甲油.Label15.Text
  440. Dim m_訂購數量12a = 指甲油.TextBox5.Text
  441. Dim sqladd12a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "l" + 耳環.Label20.Text & "','" & 指甲油.Label15.Text & "','" & 指甲油.TextBox5.Text & "')"
  442. Dim add12a = New SqlCommand(sqladd12a, conn)
  443. add12a.ExecuteNonQuery()
  444. Me.Visible = False
  445. conn.Close()
  446. Try
  447. Me.訂購TableAdapter.InsertQuery(m_會員編號12, m_商品編號12a, m_訂購數量12a)
  448. Catch ex25 As Exception
  449. End Try
  450. Me.訂購DataGridView.Refresh()
  451. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  452. Me.訂購BindingSource.ResetBindings(False)
  453. '新增商品編號13紀錄
  454. conn.Open()
  455. Dim m_訂單編號13 = 耳環.Label6.Text + 耳環.Label20.Text + "m"
  456. Dim m_商品編號13 = 便籤夾.Label2.Text
  457. Dim m_訂購數量13 = 便籤夾.TextBox3.Text
  458. Dim m_價錢13 = 85 * Val(便籤夾.TextBox3.Text)
  459. Dim sqladd13 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "m" & "','" & 便籤夾.Label2.Text & "','" & 便籤夾.TextBox3.Text & "','" & 85 * Val(便籤夾.TextBox3.Text) & "')"
  460. Dim add13 = New SqlCommand(sqladd13, conn)
  461. add13.ExecuteNonQuery()
  462. Me.Visible = False
  463. conn.Close()
  464. Try
  465. Me.紀錄TableAdapter.InsertQuery(m_訂單編號13, m_商品編號13, m_訂購數量13, m_價錢13)
  466. Catch ex26 As Exception
  467. End Try
  468. Me.紀錄DataGridView.Refresh()
  469. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  470. Me.紀錄BindingSource.ResetBindings(False)
  471. '新增會員購買紀錄(商品編號13)
  472. conn.Open()
  473. Dim m_會員編號13 = 耳環.Label6.Text + "m" + 耳環.Label20.Text
  474. Dim m_商品編號13a = 便籤夾.Label2.Text
  475. Dim m_訂購數量13a = 便籤夾.TextBox3.Text
  476. Dim sqladd13a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "m" + 耳環.Label20.Text & "','" & 便籤夾.Label2.Text & "','" & 便籤夾.TextBox3.Text & "')"
  477. Dim add13a = New SqlCommand(sqladd13a, conn)
  478. add13a.ExecuteNonQuery()
  479. Me.Visible = False
  480. conn.Close()
  481. Try
  482. Me.訂購TableAdapter.InsertQuery(m_會員編號13, m_商品編號13a, m_訂購數量13a)
  483. Catch ex27 As Exception
  484. End Try
  485. Me.訂購DataGridView.Refresh()
  486. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  487. Me.訂購BindingSource.ResetBindings(False)
  488. '新增商品編號14紀錄
  489. conn.Open()
  490. Dim m_訂單編號14 = 耳環.Label6.Text + 耳環.Label20.Text + "n"
  491. Dim m_商品編號14 = 手工餅乾.Label2.Text
  492. Dim m_訂購數量14 = 手工餅乾.TextBox3.Text
  493. Dim m_價錢14 = 30 * Val(手工餅乾.TextBox3.Text)
  494. Dim sqladd14 As String = "INSERT INTO 紀錄(訂單編號,商品編號,訂購數量,價錢) VALUES('" & 耳環.Label6.Text + 耳環.Label20.Text + "n" & "','" & 手工餅乾.Label2.Text & "','" & 手工餅乾.TextBox3.Text & "','" & 30 * Val(手工餅乾.TextBox3.Text) & "')"
  495. Dim add14 = New SqlCommand(sqladd14, conn)
  496. add14.ExecuteNonQuery()
  497. Me.Visible = False
  498. conn.Close()
  499. Try
  500. Me.紀錄TableAdapter.InsertQuery(m_訂單編號14, m_商品編號14, m_訂購數量14, m_價錢14)
  501. Catch ex28 As Exception
  502. End Try
  503. Me.紀錄DataGridView.Refresh()
  504. Me.紀錄BindingSource.DataSource = 紀錄TableAdapter.GetData()
  505. Me.紀錄BindingSource.ResetBindings(False)
  506. '新增會員購買紀錄(商品編號14)
  507. conn.Open()
  508. Dim m_會員編號14 = 耳環.Label6.Text + "n" + 耳環.Label20.Text
  509. Dim m_商品編號14a = 手工餅乾.Label2.Text
  510. Dim m_訂購數量14a = 手工餅乾.TextBox3.Text
  511. Dim sqladd14a As String = "INSERT INTO 訂購(會員編號,商品編號,訂購數量) VALUES('" & 耳環.Label6.Text + "n" + 耳環.Label20.Text & "','" & 手工餅乾.Label2.Text & "','" & 手工餅乾.TextBox3.Text & "')"
  512. Dim add14a = New SqlCommand(sqladd14a, conn)
  513. add14a.ExecuteNonQuery()
  514. Me.Visible = False
  515. conn.Close()
  516. Try
  517. Me.訂購TableAdapter.InsertQuery(m_會員編號14, m_商品編號14a, m_訂購數量14a)
  518. Catch ex29 As Exception
  519. End Try
  520. Me.訂購DataGridView.Refresh()
  521. Me.訂購BindingSource.DataSource = 訂購TableAdapter.GetData()
  522. Me.訂購BindingSource.ResetBindings(False)
  523. '修改商品編號1庫存數量
  524. conn.Open()
  525. Dim m_庫存數量1 = Val(耳環.Label21.Text) - Val(耳環.TextBox2.Text)
  526. Dim m_商品編號1b = 耳環.Label25.Text
  527. Dim sqlupd1 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(耳環.Label21.Text) - Val(耳環.TextBox2.Text) & "' WHERE 商品編號 ='" & 耳環.Label25.Text & "'"
  528. Dim upd1 = New SqlCommand(sqlupd1, conn)
  529. Try
  530. upd1.ExecuteNonQuery()
  531. Catch ex30 As Exception
  532. End Try
  533. conn.Close()
  534. Try
  535. 商品TableAdapter.UpdateQueryNumber(m_庫存數量1, m_商品編號1b)
  536. Catch ex31 As Exception
  537. End Try
  538. Me.商品DataGridView.Refresh()
  539. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  540. Me.商品BindingSource.ResetBindings(False)
  541. '修改商品編號2庫存數量
  542. conn.Open()
  543. Dim m_庫存數量2 = Val(耳環.Label22.Text) - Val(耳環.TextBox3.Text)
  544. Dim m_商品編號2b = 耳環.Label26.Text
  545. Dim sqlupd2 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(耳環.Label22.Text) - Val(耳環.TextBox3.Text) & "' WHERE 商品編號 ='" & 耳環.Label26.Text & "'"
  546. Dim upd2 = New SqlCommand(sqlupd2, conn)
  547. Try
  548. upd2.ExecuteNonQuery()
  549. Catch ex32 As Exception
  550. End Try
  551. conn.Close()
  552. Try
  553. 商品TableAdapter.UpdateQueryNumber(m_庫存數量2, m_商品編號2b)
  554. Catch ex33 As Exception
  555. End Try
  556. Me.商品DataGridView.Refresh()
  557. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  558. Me.商品BindingSource.ResetBindings(False)
  559. '修改商品編號3庫存數量
  560. conn.Open()
  561. Dim m_庫存數量3 = Val(耳環.Label23.Text) - Val(耳環.TextBox4.Text)
  562. Dim m_商品編號3b = 耳環.Label27.Text
  563. Dim sqlupd3 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(耳環.Label23.Text) - Val(耳環.TextBox4.Text) & "' WHERE 商品編號 ='" & 耳環.Label27.Text & "'"
  564. Dim upd3 = New SqlCommand(sqlupd3, conn)
  565. Try
  566. upd3.ExecuteNonQuery()
  567. Catch ex34 As Exception
  568. End Try
  569. conn.Close()
  570. Try
  571. 商品TableAdapter.UpdateQueryNumber(m_庫存數量3, m_商品編號3b)
  572. Catch ex35 As Exception
  573. End Try
  574. Me.商品DataGridView.Refresh()
  575. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  576. Me.商品BindingSource.ResetBindings(False)
  577. '修改商品編號4庫存數量
  578. conn.Open()
  579. Dim m_庫存數量4 = Val(耳環.Label24.Text) - Val(耳環.TextBox5.Text)
  580. Dim m_商品編號4b = 耳環.Label28.Text
  581. Dim sqlupd4 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(耳環.Label24.Text) - Val(耳環.TextBox5.Text) & "' WHERE 商品編號 ='" & 耳環.Label28.Text & "'"
  582. Dim upd4 = New SqlCommand(sqlupd4, conn)
  583. Try
  584. upd4.ExecuteNonQuery()
  585. Catch ex36 As Exception
  586. End Try
  587. conn.Close()
  588. Try
  589. 商品TableAdapter.UpdateQueryNumber(m_庫存數量4, m_商品編號4b)
  590. Catch ex37 As Exception
  591. End Try
  592. Me.商品DataGridView.Refresh()
  593. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  594. Me.商品BindingSource.ResetBindings(False)
  595. '修改商品編號5庫存數量
  596. conn.Open()
  597. Dim m_庫存數量5 = Val(吊飾.Label20.Text) - Val(吊飾.TextBox2.Text)
  598. Dim m_商品編號5b = 吊飾.Label12.Text
  599. Dim sqlupd5 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(吊飾.Label20.Text) - Val(吊飾.TextBox2.Text) & "' WHERE 商品編號 ='" & 吊飾.Label12.Text & "'"
  600. Dim upd5 = New SqlCommand(sqlupd5, conn)
  601. Try
  602. upd5.ExecuteNonQuery()
  603. Catch ex38 As Exception
  604. End Try
  605. conn.Close()
  606. Try
  607. 商品TableAdapter.UpdateQueryNumber(m_庫存數量5, m_商品編號5b)
  608. Catch ex39 As Exception
  609. End Try
  610. Me.商品DataGridView.Refresh()
  611. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  612. Me.商品BindingSource.ResetBindings(False)
  613. '修改商品編號6庫存數量
  614. conn.Open()
  615. Dim m_庫存數量6 = Val(吊飾.Label21.Text) - Val(吊飾.TextBox3.Text)
  616. Dim m_商品編號6b = 吊飾.Label13.Text
  617. Dim sqlupd6 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(吊飾.Label21.Text) - Val(吊飾.TextBox3.Text) & "' WHERE 商品編號 ='" & 吊飾.Label13.Text & "'"
  618. Dim upd6 = New SqlCommand(sqlupd6, conn)
  619. Try
  620. upd6.ExecuteNonQuery()
  621. Catch ex40 As Exception
  622. End Try
  623. conn.Close()
  624. Try
  625. 商品TableAdapter.UpdateQueryNumber(m_庫存數量6, m_商品編號6b)
  626. Catch ex41 As Exception
  627. End Try
  628. Me.商品DataGridView.Refresh()
  629. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  630. Me.商品BindingSource.ResetBindings(False)
  631. '修改商品編號7庫存數量
  632. conn.Open()
  633. Dim m_庫存數量7 = Val(吊飾.Label22.Text) - Val(吊飾.TextBox4.Text)
  634. Dim m_商品編號7b = 吊飾.Label14.Text
  635. Dim sqlupd7 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(吊飾.Label22.Text) - Val(吊飾.TextBox4.Text) & "' WHERE 商品編號 ='" & 吊飾.Label14.Text & "'"
  636. Dim upd7 = New SqlCommand(sqlupd7, conn)
  637. Try
  638. upd7.ExecuteNonQuery()
  639. Catch ex42 As Exception
  640. End Try
  641. conn.Close()
  642. Try
  643. 商品TableAdapter.UpdateQueryNumber(m_庫存數量7, m_商品編號7b)
  644. Catch ex43 As Exception
  645. End Try
  646. Me.商品DataGridView.Refresh()
  647. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  648. Me.商品BindingSource.ResetBindings(False)
  649. '修改商品編號8庫存數量
  650. conn.Open()
  651. Dim m_庫存數量8 = Val(吊飾.Label23.Text) - Val(吊飾.TextBox5.Text)
  652. Dim m_商品編號8b = 吊飾.Label15.Text
  653. Dim sqlupd8 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(吊飾.Label23.Text) - Val(吊飾.TextBox5.Text) & "' WHERE 商品編號 ='" & 吊飾.Label15.Text & "'"
  654. Dim upd8 = New SqlCommand(sqlupd8, conn)
  655. Try
  656. upd8.ExecuteNonQuery()
  657. Catch ex44 As Exception
  658. End Try
  659. conn.Close()
  660. Try
  661. 商品TableAdapter.UpdateQueryNumber(m_庫存數量8, m_商品編號8b)
  662. Catch ex45 As Exception
  663. End Try
  664. Me.商品DataGridView.Refresh()
  665. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  666. Me.商品BindingSource.ResetBindings(False)
  667. '修改商品編號9庫存數量
  668. conn.Open()
  669. Dim m_庫存數量9 = Val(指甲油.Label20.Text) - Val(指甲油.TextBox3.Text)
  670. Dim m_商品編號9b = 指甲油.Label12.Text
  671. Dim sqlupd9 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(指甲油.Label20.Text) - Val(指甲油.TextBox3.Text) & "' WHERE 商品編號 ='" & 指甲油.Label12.Text & "'"
  672. Dim upd9 = New SqlCommand(sqlupd9, conn)
  673. Try
  674. upd9.ExecuteNonQuery()
  675. Catch ex46 As Exception
  676. End Try
  677. conn.Close()
  678. Try
  679. 商品TableAdapter.UpdateQueryNumber(m_庫存數量9, m_商品編號9b)
  680. Catch ex47 As Exception
  681. End Try
  682. Me.商品DataGridView.Refresh()
  683. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  684. Me.商品BindingSource.ResetBindings(False)
  685. '修改商品編號10庫存數量
  686. conn.Open()
  687. Dim m_庫存數量10 = Val(指甲油.Label21.Text) - Val(指甲油.TextBox2.Text)
  688. Dim m_商品編號10b = 指甲油.Label13.Text
  689. Dim sqlupd10 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(指甲油.Label21.Text) - Val(指甲油.TextBox2.Text) & "' WHERE 商品編號 ='" & 指甲油.Label13.Text & "'"
  690. Dim upd10 = New SqlCommand(sqlupd10, conn)
  691. Try
  692. upd10.ExecuteNonQuery()
  693. Catch ex48 As Exception
  694. End Try
  695. conn.Close()
  696. Try
  697. 商品TableAdapter.UpdateQueryNumber(m_庫存數量10, m_商品編號10b)
  698. Catch ex49 As Exception
  699. End Try
  700. Me.商品DataGridView.Refresh()
  701. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  702. Me.商品BindingSource.ResetBindings(False)
  703. '修改商品編號11庫存數量
  704. conn.Open()
  705. Dim m_庫存數量11 = Val(指甲油.Label22.Text) - Val(指甲油.TextBox4.Text)
  706. Dim m_商品編號11b = 指甲油.Label14.Text
  707. Dim sqlupd11 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(指甲油.Label22.Text) - Val(指甲油.TextBox4.Text) & "' WHERE 商品編號 ='" & 指甲油.Label14.Text & "'"
  708. Dim upd11 = New SqlCommand(sqlupd11, conn)
  709. Try
  710. upd11.ExecuteNonQuery()
  711. Catch ex50 As Exception
  712. End Try
  713. conn.Close()
  714. Try
  715. 商品TableAdapter.UpdateQueryNumber(m_庫存數量11, m_商品編號11b)
  716. Catch ex51 As Exception
  717. End Try
  718. Me.商品DataGridView.Refresh()
  719. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  720. Me.商品BindingSource.ResetBindings(False)
  721. '修改商品編號12庫存數量
  722. conn.Open()
  723. Dim m_庫存數量12 = Val(指甲油.Label23.Text) - Val(指甲油.TextBox5.Text)
  724. Dim m_商品編號12b = 指甲油.Label15.Text
  725. Dim sqlupd12 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(指甲油.Label23.Text) - Val(指甲油.TextBox5.Text) & "' WHERE 商品編號 ='" & 指甲油.Label15.Text & "'"
  726. Dim upd12 = New SqlCommand(sqlupd12, conn)
  727. Try
  728. upd12.ExecuteNonQuery()
  729. Catch ex52 As Exception
  730. End Try
  731. conn.Close()
  732. Try
  733. 商品TableAdapter.UpdateQueryNumber(m_庫存數量12, m_商品編號12b)
  734. Catch ex53 As Exception
  735. End Try
  736. Me.商品DataGridView.Refresh()
  737. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  738. Me.商品BindingSource.ResetBindings(False)
  739. '修改商品編號13庫存數量
  740. conn.Open()
  741. Dim m_庫存數量13 = Val(便籤夾.Label5.Text) - Val(便籤夾.TextBox3.Text)
  742. Dim m_商品編號13b = 便籤夾.Label2.Text
  743. Dim sqlupd13 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(便籤夾.Label5.Text) - Val(便籤夾.TextBox3.Text) & "' WHERE 商品編號 ='" & 便籤夾.Label2.Text & "'"
  744. Dim upd13 = New SqlCommand(sqlupd13, conn)
  745. Try
  746. upd13.ExecuteNonQuery()
  747. Catch ex54 As Exception
  748. End Try
  749. conn.Close()
  750. Try
  751. 商品TableAdapter.UpdateQueryNumber(m_庫存數量13, m_商品編號13b)
  752. Catch ex55 As Exception
  753. End Try
  754. Me.商品DataGridView.Refresh()
  755. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  756. Me.商品BindingSource.ResetBindings(False)
  757. '修改商品編號14庫存數量
  758. conn.Open()
  759. Dim m_庫存數量14 = Val(手工餅乾.Label5.Text) - Val(手工餅乾.TextBox3.Text)
  760. Dim m_商品編號14b = 手工餅乾.Label2.Text
  761. Dim sqlupd14 As String = "UPDATE 商品 Set 商品編號 = 庫存數量 = '" & Val(手工餅乾.Label5.Text) - Val(手工餅乾.TextBox3.Text) & "' WHERE 商品編號 ='" & 手工餅乾.Label2.Text & "'"
  762. Dim upd14 = New SqlCommand(sqlupd14, conn)
  763. Try
  764. upd14.ExecuteNonQuery()
  765. Catch ex56 As Exception
  766. End Try
  767. conn.Close()
  768. Try
  769. 商品TableAdapter.UpdateQueryNumber(m_庫存數量14, m_商品編號14b)
  770. Catch ex57 As Exception
  771. End Try
  772. Me.商品DataGridView.Refresh()
  773. Me.商品BindingSource.DataSource = 商品TableAdapter.GetData()
  774. Me.商品BindingSource.ResetBindings(False)
  775. End Sub
  776. Private Sub 訂單確認_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  777. 'TODO: 這行程式碼會將資料載入 '謎鹿DataSet.商品' 資料表。您可以視需要進行移動或移除。
  778. Me.商品TableAdapter.Fill(Me.謎鹿DataSet.商品)
  779. 'TODO: 這行程式碼會將資料載入 '謎鹿DataSet.訂購' 資料表。您可以視需要進行移動或移除。
  780. Me.訂購TableAdapter.Fill(Me.謎鹿DataSet.訂購)
  781. 'TODO: 這行程式碼會將資料載入 '謎鹿DataSet.紀錄' 資料表。您可以視需要進行移動或移除。
  782. Me.紀錄TableAdapter.Fill(Me.謎鹿DataSet.紀錄)
  783. 'TODO: 這行程式碼會將資料載入 '謎鹿DataSet.訂單' 資料表。您可以視需要進行移動或移除。
  784. Me.訂單TableAdapter.Fill(Me.謎鹿DataSet.訂單)
  785. 'TODO: 這行程式碼會將資料載入 '謎鹿DataSet.訂單' 資料表。您可以視需要進行移動或移除。
  786. Me.訂單TableAdapter.Fill(Me.謎鹿DataSet.訂單)
  787. Label6.Text = 購物車.Label48.Text
  788. End Sub
  789. End Class