Item removing from MySQL via Visual Basic

In the project I still making I’m using MySQL database to storing items. We can remove items from database. How to remove item from MySQL via Visual Basic?

Attention! This post has been published on my old website that has been down. I’m archiving old not verified posts for possible future use. Please be careful when using this post content.

In order to remove item from MySQL table following query has to be used:

DELETE FROM TableName WHERE DB_ColumnName='YourRecord';

Following code is consisted of:

  • MySqlConnection – connection to MySQL database,
  • MySqlDataAdapter – query to MySQL,
  • Try – trying open connection,
  • Exception – error handling.

Whole code to connect MySQL database and remove some item:

Imports MySql.Data.MySqlClient

Public Sub UsunLokacje()
' Item removing from MySQL database

Dim dTableCount As Long
Dim dTable1 As New DataTable

'1. Connection data
'-------------------------------------
Dim conn As MySqlConnection = New MySqlConnection() ' forgot source
conn.ConnectionString = "Data Source=" & fmMain.txtMYSQLpath.Text & "; Database=" & fmMain.txtOPCJEnazwaMYSQL.Text & _
    "; Uid=root; Pwd=" & fmMain.txtOPCJEhasloMYSQL.Text & ";"

Try

    conn.Open() ' open connection

    Try
        ' Checking if item is in table
        ' -----------------------------------------
        Dim adapter As MySqlDataAdapter = New MySqlDataAdapter("SELECT * FROM nazwylokacji WHERE Lokacja='" & _
                                         fmMain.txtOPCJETornadoLokacja.Text & "';", conn)

        adapter.Fill (dTable1)
        dTableCount = dTable1.Rows.Count
        
        If dTableCount > 0 Then
            ' Item removing
            ' ---------------------------------
            Dim cmd1 As MySqlCommand = New MySqlCommand("DELETE FROM nazwylokacji WHERE Lokacja='" & _
                                         fmMain.txtOPCJETornadoLokacja.Text & "';", conn)
            cmd1.ExecuteNonQuery() 'usuwanie wartości z MySQL
            cmd1 = Nothing
            conn.Close()
    
            ' Confiramtion for user
            ' -------------------------------------------------
            MsgBox("Location '" & fmMain.txtOPCJETornadoLokacja.Text & "' has been removed.", vbInformation, "Confirmation...")
        Else
            MsgBox("Location can't be removed: '" & fmMain.txtOPCJETornadoLokacja.Text & "'.", vbCritical, "Error...")
        End If
    Catch ex1 As Exception
        MsgBox("Error when location removing. Table: 'nazwylokacji'." + Chr(10) + Chr(10) + "Err no.:" + Chr(10) + ex1.Message, _
       MsgBoxStyle.Critical, "Error...")
    End Try

Catch ex As Exception

    MsgBox("Database connection problem. Table: 'nazwylokacji'." + Chr(10) + Chr(10) + "Kod błedu:" + Chr(10) + ex.Message, _
        MsgBoxStyle.Critical, "Conenction error...")
    conn.Close()

Finally
    conn.Dispose()
    fmMain.txtOPCJETornadoLokacja.Clear()
    Call modDBgrid.IloscTornado   ' DataGridView refresh
End Try

End Sub

377 thoughts on “Item removing from MySQL via Visual Basic

  1. Pingback: soi lo de

  2. Pingback: cach choi number game

  3. Pingback: buy lortab pills online pharmacy no presption next day shipping discreet

  4. Pingback: mo thay nguoi chet danh con gi

  5. Pingback: order ativan online in usa canada uk australia without prescription nextday shipping

  6. Pingback: danh de online uy tin

  7. Pingback: gomovies-online

  8. Pingback: con cho so may

  9. Pingback: bitcoin evolution review

  10. Pingback: UNIQCC

  11. Pingback: is blazing trader a scam?

  12. Pingback: Making Money Online

  13. Pingback: Hotels in San Diego

  14. Pingback: buy/order Tangie OG Cannabis Oil online use for pain, anxiety, sleep for sale near me bulk in usa uk nz canada australia overnight delivery

  15. Pingback: eatverts

  16. Pingback: More Help

  17. Pingback: thenaturalpenguin

  18. Pingback: buy roxicodone 5 mg for sale overnight delivery cheap

  19. Pingback: pinewswire

  20. Pingback: English bulldog puppies for sale near me in MN MD CT NJ AZ AK LA WV ND IW NC NB WA NV MI

  21. Pingback: bitcoin loophole

  22. Pingback: Immediate Edge Review 2020

  23. Pingback: ریور پوکر

  24. Pingback: mơ thấy anh em gặp nhau

  25. Pingback: mơ thấy con mèo đánh con gì

  26. Pingback: mơ thấy xe tải

  27. Pingback: mơ mình chết đánh con gì

  28. Pingback: Pinball Machines for Sale

  29. Pingback: labradoodle puppies for sale near me

  30. Pingback: nằm mơ thấy mình bay lơ lửng

  31. Pingback: interqq

  32. Pingback: mo ran can

  33. Pingback: nằm mơ thấy sập nhà

  34. Pingback: Earn Fast Cash Now

  35. Pingback: mơ thấy bị bắn

  36. Pingback: mơ thấy cóc đánh con gì

  37. Pingback: XFINITY Store by Comcast

  38. Pingback: DevOps Consulting Services

  39. Pingback: nằm mơ thấy chó đẻ con

  40. Pingback: nằm mơ thấy mẹ bị bệnh

  41. Pingback: mơ thấy người nổi tiếng

  42. Pingback: dơi bay vào nhà tốt hay xấu

  43. Pingback: mơ thấy xe máy đánh con gì

  44. Pingback: nhân mã nam và nhân mã nữ

  45. Pingback: con số may mắn của ma kết

  46. Pingback: cung song tử hợp với cung nào nhất

  47. Pingback: quả mít là số mấy

  48. Pingback: mơ thấy xương người

  49. Pingback: mơ thấy ác mộng

  50. Pingback: nằm mơ thấy chạy xe đạp

  51. Pingback: mơ thấy người yêu cũ chết

  52. Pingback: buy cialis overnight

  53. Pingback: buy levitra 20mg

  54. Pingback: cialis lethargy

  55. Pingback: viagra women

  56. Pingback: order cialis 20 mg

  57. Pingback: online pharmacy no prescription

  58. Pingback: pharmacy

  59. Pingback: canadian online pharmacies legitimate by aarp

  60. Pingback: erection pills

  61. Pingback: viagra

  62. Pingback: cialis canadian pharmacy

  63. Pingback: viagra cialis combo

  64. Pingback: monthly cost of cialis without insurance

  65. Pingback: cialis buy online

  66. Pingback: buy cialis united kingdom

  67. Pingback: cialis payment with paypal

  68. Pingback: buy cialis shipping canada

  69. Pingback: cialis 5mg tablet

  70. Pingback: cialis brand no prescription 365

  71. Pingback: viagra pills cheap

  72. Pingback: canada cialis online

  73. Pingback: buy cialis tadalafil0 with pay pal

  74. Pingback: cheap generic cialis

  75. Pingback: cialis online without prescription

  76. Pingback: ngecjhph

  77. Pingback: where can i buy kamagra

  78. Pingback: wanneer werkt viagra niet

  79. Pingback: what can zithromax treat

  80. Pingback: buy cialis online in canada

  81. Pingback: cialis e ipertrofia prostatica

  82. Pingback: cialis

  83. Pingback: monthly cost of cialis without insurance

  84. Pingback: canadian viagra

  85. Pingback: cialis 5mg tablet

  86. Pingback: comprar viagra online espaГ±a

  87. Pingback: ordering cialis online australia

  88. Pingback: custom essay writing service uk

  89. Pingback: cialis tadalafil portugal

  90. Pingback: custom research paper writing services

  91. Pingback: what should i write about in my college essay

  92. Pingback: i need help with my college essay

  93. Pingback: business ethics essay thesis statement

  94. Pingback: monthly cost of cialis without insurance

  95. Pingback: antibiotics augmentin

  96. Pingback: lasix 500 mg tab

  97. Pingback: canadian pharmacy azithromycin buy online

  98. Pingback: stromectol pill price

  99. Pingback: 2.5 albuterol

  100. Pingback: prednisolone 5mg uses

  101. Pingback: hcg and clomid

  102. Pingback: buying dapoxetine

  103. Pingback: diflucan thrush

  104. Pingback: synthroid com

  105. Pingback: writing your thesis

  106. Pingback: propecia package insert

  107. Pingback: neurontin 400 mg

  108. Pingback: metformin function

  109. Pingback: paxil 40 mg

  110. Pingback: plaquenil covid 19

  111. Pingback: buy metformin without prescription cheap

  112. Pingback: buy generic propecia

  113. Pingback: buy cialis philippines

  114. Pingback: mens erection pills

  115. Pingback: find cheap cialis online

  116. Pingback: online pharmacy pain

  117. Pingback: Zakhar Berkut hd

  118. Pingback: sure save pharmacy

  119. Pingback: 4569987

  120. Pingback: buy cialis tadalafil0 with pay pal

  121. Pingback: buy cialis online generic

  122. Pingback: 20 mg cost

  123. Pingback: buy cialis online overnight

  124. Pingback: news news news

  125. Pingback: online cash advance downey

  126. Pingback: psy

  127. Pingback: psy2022

  128. Pingback: projectio-freid

  129. Pingback: cialis denavir yasmin retin a

  130. Pingback: http://tinderentrar.com

  131. Pingback: payday cash advance hendersonville

  132. Pingback: kinoteatrzarya.ru

  133. Pingback: topvideos

  134. Pingback: video

  135. Pingback: walgreen viagra

  136. Pingback: buy toronto

  137. Pingback: zestril 5 mg prices

  138. Pingback: afisha-kinoteatrov.ru

  139. Pingback: Ukrainskie-serialy

  140. Pingback: site

  141. Pingback: where can i get cialis over the counter

  142. Pingback: plenty of fish free dating sign in

  143. Pingback: too much cialis

  144. Pingback: viagra and cialis discount

  145. Pingback: buy real ativan online

  146. Pingback: top

  147. Pingback: viagra vs cialis vs levitra cost

  148. Pingback: good canadian pharmacies

  149. Pingback: cialis or levitra

  150. Pingback: buy cialis 36 hour

  151. Pingback: Aspirin

  152. Pingback: buy cialis philippines

  153. Pingback: buy cheap cialis overnight

  154. Pingback: best canadian pet pharmacy

  155. Pingback: generic cialis daily pricing

  156. Pingback: where can i buy cialis without a prescription

  157. Pingback: can i buy cialis in uk

  158. Pingback: cialis 5mg tablet

  159. Pingback: what are ed drugs

  160. Pingback: tadalafil herbal substitute

  161. Pingback: buy valtrex singapore

  162. Pingback: viagra and alcohol

  163. Pingback: ed remedies

  164. Pingback: black cialis c800

  165. Pingback: 100 mg viagra

  166. Pingback: tadalafil generic usa

  167. Pingback: viagra instructions

  168. Pingback: cialis efectos secundarios

  169. Pingback: sildenafil 50 coupon

  170. Pingback: where can i buy viagra over the counter

  171. Pingback: generic cialis 20mg

  172. Pingback: sildenafil price australia

  173. Pingback: soderzhanki-3-sezon-2021.online

  174. Pingback: chelovek-iz-90-h

  175. Pingback: podolsk-region.ru

  176. Pingback: diclofenac natrium

  177. Pingback: natural pills for ed

  178. Pingback: bender na4alo 2021

  179. Pingback: blogery_i_dorogi

  180. Pingback: blogery_i_dorogi 2 blogery_i_dorogi

  181. Pingback: ed for men

  182. Pingback: stromectol buy

  183. Pingback: generic plaquenil coupon

  184. Pingback: stromectol prices

  185. Pingback: ivermectin for humans

  186. Pingback: ed treatment review

  187. Pingback: chernaya vodova

  188. Pingback: 66181

  189. Pingback: sildenafil cost comparison

  190. Pingback: buy ed drugs online

  191. Pingback: Porno

  192. Pingback: vechernyy urgant

  193. Pingback: ukraine

  194. Pingback: viagra without a doctor prescription

  195. Pingback: A3ixW7AS

  196. Pingback: buy cialis online in canada

  197. Pingback: gidonline-ok-google

  198. Pingback: link

  199. Pingback: KremlinTeam

  200. Pingback: medunitsa.ru

  201. Pingback: kremlin-team.ru

  202. Pingback: psychophysics.ru

  203. Pingback: hydroxychloroquine 90 mg

  204. Pingback: tadalafil cialis bestprice

  205. Pingback: Suicide Squad 2

  206. Pingback: psiholog

  207. Pingback: regcialist.com

  208. Pingback: canadianpharmacymeds

  209. Pingback: eli lilly cialis

  210. Pingback: hizhnyak-07-08-2021

  211. Pingback: viagra alternatives over the counter

  212. Pingback: how to tell if a man is taking viagra

  213. Pingback: zithromax

  214. Pingback: female viagra effects

  215. Pingback: walmart pharmacy bentonville ar store 100

  216. Pingback: zithromax 500mg price in india

  217. Pingback: cheap drugs canada

  218. Pingback: ingrediants in viagra

  219. Pingback: ivermectin uk coronavirus

  220. Pingback: ed pills for sale

  221. Pingback: drugs prices

  222. Pingback: hydroxychloroquine generic

  223. Pingback: cialis 20 mg from united kingdom

  224. Pingback: cialis with dapoxetine or viagra with dapoxetine better

  225. Pingback: prednisone buying

  226. Pingback: atorvastatin pronounce

  227. Pingback: prilosec directions

  228. Pingback: fluoxetine heartburn

  229. Pingback: quetiapine urinary retention

  230. Pingback: zoloft contraindications

  231. Pingback: what effects can happen from drinking alcohol with escitalopram oxalate

  232. Pingback: pills from canada

  233. Pingback: what is the difference between gabapentin and lyrica

  234. Pingback: viagra canada

  235. Pingback: managing cymbalta withdrawal

  236. Pingback: hydrochlorothiazide and diabetes

  237. Pingback: cheapest viagra

  238. Pingback: ivermectin 4 tablets price

  239. Pingback: cheapest generic viagra

  240. Pingback: medicines atorvastatin

  241. Pingback: viagra for sale

  242. Pingback: viagra pills

  243. Pingback: cialis orange pill

  244. Pingback: taking lexapro at night

  245. Pingback: medications online

  246. Pingback: cialis official site

  247. Pingback: cialis pills online

  248. Pingback: official cialis website

  249. Pingback: how to buy cialis

  250. Pingback: cialis 20 mg daily use

  251. Pingback: Duna 2021

  252. Pingback: sildenafil 20mg

  253. Pingback: female viagra

  254. Pingback: how long does cymbalta take to work

  255. Pingback: cost of viagra

  256. Pingback: 1

  257. Pingback: where can i buy cialis pills

  258. Pingback: viagra without a doctor prescription

  259. Pingback: female viagra 2018

  260. Pingback: where can you purchase viagra

  261. Pingback: buy amoxicillin online cheap

  262. Pingback: cialis generic over the counter

  263. Pingback: buy cheap clomid

  264. Pingback: viagra buy online

  265. Pingback: propecia union pharmacy

  266. Pingback: cheap viagra online canadian pharmacy

  267. Pingback: ivermectin iv

  268. Pingback: where to buy cialis pills

  269. Pingback: stromectol ivermectin tablets

  270. Pingback: canada buy prednisone online

  271. Pingback: doxycycline mono

  272. Pingback: vibramycin 100 mg

  273. Pingback: doxycycline without a prescription

  274. Pingback: cialis online

  275. Pingback: sildenafil medication

  276. Pingback: ivermectin corona covid

  277. Pingback: buying viagra from canada

  278. Pingback: cialis australia online shopping

  279. Pingback: discount generic cialis canada

  280. Pingback: buy generic 100mg viagra online

  281. Pingback: stromectol for covid 19

  282. Pingback: stromectol for yeast infection

  283. Pingback: where can i buy viagra or cialis

  284. Pingback: can ivermectin paste be used topically

  285. Pingback: ivermectin pills amazon

  286. Pingback: hydroxychloroquine with zithramax

  287. Pingback: ivermectin cattle pour on

  288. Pingback: get viagra without prescription

  289. Pingback: viagra professional scam

  290. Pingback: viagra toronto headquarters

  291. Pingback: soolantra ivermectin cream 1

  292. Pingback: can i buy ventolin at boots

  293. Pingback: es el mejor viagra natural?

  294. Pingback: buy ivermectin near me

  295. Pingback: ivermectin covid treatment

  296. Pingback: viagra pills what is it

  297. Pingback: natural viagra india

  298. Pingback: ivermectin where to purchase

  299. Pingback: legal to buy prescription drugs from canada

  300. Pingback: tadalafil cost walmart

  301. Pingback: ed meds online canada

  302. Pingback: 20mg cialis

  303. Pingback: ebay cialis

  304. Pingback: how to get prescription drugs without doctor

  305. Pingback: do you need a prescription for zithromax

  306. Pingback: where can i buy a viagra

  307. Pingback: where to buy viagra from in uk

  308. Pingback: buying sildenafil citrate online

  309. Pingback: ed pills online

  310. Pingback: buy sildenafil

  311. Pingback: order lisinopril hctz

  312. Pingback: using dapoxetine

  313. Pingback: cheapest way to get cialis

  314. Pingback: canadian pharmacy generic viagra

  315. Pingback: buy cheap cialis super active

  316. Pingback: tamoxifen brand name

  317. Pingback: does tamoxifen make you tired

  318. Pingback: buying prednisone on line

  319. Pingback: where to buy prednisone 20mg

  320. Pingback: prednisone 20mg tab price

  321. Pingback: ivermectin buy australia

  322. Pingback: ivermectin uk coronavirus

  323. Pingback: ivermectin 10 mg

  324. Pingback: azithromycin otc cvs

  325. Pingback: prescription drugs without doctor approval

  326. Pingback: cat antibiotics without pet prescription

  327. Pingback: viagra alternative

  328. Pingback: clamelle otc

  329. Pingback: viagra buy tesco

  330. Pingback: best ed pills non prescription

  331. Pingback: cleantalkorg2.ru

  332. Pingback: herbal viagra

  333. Pingback: viagra without a doctor

  334. Pingback: 200 mg prednisone daily

  335. Pingback: prednisone canada pharmacy

  336. Pingback: prednisone tablets 2.5 mg

  337. Pingback: purchase viagra online without prescription

  338. Pingback: viagra history

  339. Pingback: natural alternatives to viagra

  340. Pingback: viagra boys

  341. Pingback: ivermectin lotion

  342. Pingback: amoxil USA

  343. Pingback: viagra jokes

  344. Pingback: buying lasix online

  345. Pingback: how does viagra work

  346. Pingback: neurontin 50mg cost

  347. Pingback: play slots online with real money

  348. Pingback: plaquenil sulfate

  349. Pingback: prednisone otc uk

  350. Pingback: viagra alternatives

  351. Pingback: priligy pills

  352. Pingback: buy enunie provigil

  353. Pingback: stromectol medicine

  354. Pingback: ventolin prices

  355. Pingback: zithromax online

  356. Pingback: furosemide cost price

  357. Pingback: roman viagra

  358. Pingback: gabapentin 1500 mg

  359. Pingback: natural viagra recipe

  360. Pingback: plaquenil brand name

  361. Pingback: viagra from canada

  362. Pingback: how to take modafinil

  363. Pingback: stromectol in canada

  364. Pingback: natural viagra for men

  365. Pingback: valtrex generic cheap

  366. Pingback: alternatives to viagra

  367. Pingback: brand viagra

  368. Pingback: cheapest on line valtrex without a prescription

  369. Pingback: roman sildenafil

  370. Pingback: valtrex rx where to buy

  371. Pingback: valtrex where to buy canada

  372. Pingback: generic sildenafil

  373. Pingback: cheap generic drugs from india

  374. Pingback: generic ed pills from canada

  375. Pingback: generic drugs online

  376. Pingback: how to take 20 mg cialis

  377. Pingback: cialis strength levels

Leave a Reply

Your email address will not be published. Required fields are marked *