943,889 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 3868
  • VB.NET RSS
Jul 18th, 2009
0

Retrieve data from MYSQL using VB.NET

Expand Post »
Hi ALL,

Plz tell me how to retrieve data from mysql using vb.net as frontend.
I created database in mysql and able to insert data from vb.net but i dont know how to retrieve data from mysql. Plz help me to perform this action. Plz post your reply for my question....


Regards,
Karthikeyan.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cee_karthi is offline Offline
5 posts
since Jun 2009
Jul 18th, 2009
0

Re: Retrieve data from MYSQL using VB.NET

cee_karthi,
Which database product are using MYSQL or MSSQL? Post code if you have. Your source must be surrounded with bb code tags.

[code=vb.net]
.. statements..
[/code]
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jul 18th, 2009
0

Re: Retrieve data from MYSQL using VB.NET

Click to Expand / Collapse  Quote originally posted by adatapost ...
cee_karthi,
Which database product are using MYSQL or MSSQL? Post code if you have. Your source must be surrounded with bb code tags.

[code=vb.net]
.. statements..
[/code]

Im using MYSQL. I indicated correctly in the first thread itself.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cee_karthi is offline Offline
5 posts
since Jun 2009
Jul 18th, 2009
0

Re: Retrieve data from MYSQL using VB.NET

Show us your code work.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jul 18th, 2009
0

Re: Retrieve data from MYSQL using VB.NET

Check my blog post- http://dotnet.tekyt.info/?p=27

If you still have any doubts, feel free to ask
Reputation Points: 32
Solved Threads: 14
Junior Poster
tuse is offline Offline
173 posts
since Jul 2007
Jul 18th, 2009
-1

Re: Retrieve data from MYSQL using VB.NET

Use SqlDataReader
and then ExecuteReader
Reputation Points: 22
Solved Threads: 9
Junior Poster
Piya27 is offline Offline
112 posts
since Jun 2009
Jul 20th, 2009
-1

Re: Retrieve data from MYSQL using VB.NET

hi cee_karthi,
if you hv been able to solved your problem..then please mark this thread as solved...
Reputation Points: 22
Solved Threads: 9
Junior Poster
Piya27 is offline Offline
112 posts
since Jun 2009
Sep 11th, 2009
-1

Re: Retrieve data from MYSQL using VB.NET

Click to Expand / Collapse  Quote originally posted by cee_karthi ...
Hi ALL,

Plz tell me how to retrieve data from mysql using vb.net as frontend.
I created database in mysql and able to insert data from vb.net but i dont know how to retrieve data from mysql. Plz help me to perform this action. Plz post your reply for my question....


Regards,
Karthikeyan.

Hey cee_kathi,

Have u solved your problem in retriving data.. By the way i have my code here check it out:

Imports MySql.Data.MySqlClient
Imports System.Data
Public Class Form1
'Write your own Database code in VB .NET Tutorial using MySQL
'The Connection Object
'Dim objConn As MySqlConnection
'Dim objDataAdapter As MySqlDataAdapter
'Dim objDataset As DataSet

Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim objConn As MySqlConnection
Dim objDataset As New DataSet
Dim objDataAdapter As MySqlDataAdapter
Dim sqlConn As String

objConn = New MySqlConnection("server=localhost;userid=root;password=password;database=mydatabase")

objConn.Open()
sqlConn = "select * from movie"
objDataAdapter = New MySqlDataAdapter(sqlConn, objConn)
objDataAdapter.Fill(objDataset, "tblMovie")

MsgBox("The Connection is Now 'OPEN'")

objConn.Close()
MsgBox("The Connection is Now 'CLOSE'")

txtTitle.Text = objDataset.Tables("tblMovie").Rows(1).Item(1)
txtYear.Text = objDataset.Tables("tblMovie").Rows(1).Item(2)

End Sub

this is my references...
http://www.homeandlearn.co.uk/NET/nets12p5.html

hope this one would help you.

By the way can you help me can you give your source code for add data in mysql database.

Thnx..

Carl
Reputation Points: 7
Solved Threads: 0
Newbie Poster
acidcool is offline Offline
1 posts
since Sep 2009
Mar 23rd, 2011
-1
Re: Retrieve data from MYSQL using VB.NET
VB.NET Syntax (Toggle Plain Text)
  1. sqlCom = New SqlCommand("prc_InsertUniversities", sqlCon)
  2. sqlCom.CommandType = CommandType.StoredProcedure
  3. sqlCom.Parameters.Add("@Code", SqlDbType.VarChar, 20)
  4. sqlCom.Parameters.Add("@Name", SqlDbType.VarChar, 20)
  5. sqlCom.Parameters.Add("@Type", SqlDbType.VarChar, 30)
  6. sqlCom.Parameters.Add("@Address", SqlDbType.VarChar, 20)
  7. sqlCom.Parameters.Add("@Email", SqlDbType.VarChar, 20)
  8. sqlCom.Parameters.Add("@Web", SqlDbType.VarChar, 20)
  9. sqlCom.Parameters.Add("@Location", SqlDbType.VarChar, 20)
  10. sqlCom.Parameters.Add("@Period", SqlDbType.VarChar, 20)
  11. sqlCom.Parameters.Add("@Certification", SqlDbType.VarChar, 20)
  12. sqlCom.Parameters.Add("@Approved", SqlDbType.VarChar, 20)
  13. sqlCom.Parameters.Add("@Exparing", SqlDbType.VarChar, 20)
  14.  
  15. sqlCom.Parameters("@Code").Value = TextBox1.Text
  16. sqlCom.Parameters("@Name").Value = TextBox2.Text
  17. sqlCom.Parameters("@Type").Value = TextBox16.Text
  18. sqlCom.Parameters("@Address").Value = TextBox3.Text
  19. sqlCom.Parameters("@Email").Value = TextBox4.Text
  20. sqlCom.Parameters("@Web").Value = TextBox5.Text
  21. sqlCom.Parameters("@Location").Value = TextBox6.Text
  22. sqlCom.Parameters("@Period").Value = TextBox7.Text
  23. sqlCom.Parameters("@Certification").Value = TextBox13.Text
  24. sqlCom.Parameters("@Approved").Value = TextBox14.Text
  25. sqlCom.Parameters("@Exparing").Value = TextBox15.Text
  26.  
  27. Try
  28. sqlCom.ExecuteNonQuery()
  29. MessageBox.Show("Data Inserted Successfully", "hi", MessageBoxButtons.OK, MessageBoxIcon.Information)
  30. TextBox1.Text = ""
  31. TextBox2.Text = ""
  32. TextBox16.Text = ""
  33. TextBox3.Text = ""
  34. TextBox4.Text = ""
  35. TextBox5.Text = ""
  36. TextBox6.Text = ""
  37. TextBox7.Text = ""
  38. TextBox13.Text = ""
  39. TextBox14.Text = ""
  40. TextBox15.Text = ""
  41. Catch ex As Exception
  42. MessageBox.Show("Data Insertion Error", "hi", MessageBoxButtons.OK, MessageBoxIcon.Error)
  43. End Try
  44. End Sub
Last edited by Ezzaral; Mar 23rd, 2011 at 3:00 pm. Reason: Added code tags. Please use them to format any code that you post.
Reputation Points: 8
Solved Threads: 0
Newbie Poster
Kenny12 is offline Offline
1 posts
since Mar 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Value changed previous value
Next Thread in VB.NET Forum Timeline: Search Box in streamreader in visual basic





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC