Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I read a link from mysql databse???
#3
Well, your main problem is that you want to use the information retrieved from the database, right? Well, in order to actually use these variables, you must declare them outside your "while" loop. Since they are declared outside your while loop, you are not able to use them in your checkForUpdates call. That's why you were forced to put quotation marks around them, turning them into meaningless Strings, if you will.

Then, once you've moved the creation of your variables, you can directly access them in your checkForUpdates call. See the fixed code below.

[code2=vbnet]Imports MySql.Data.MySqlClient
Public Class updater
Public conn As MySqlConnection

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn = New MySqlConnection(ServerString)
Try
conn.Open()
Dim sqlquery As String = "SELECT vlink, dlink, ftpu, dtpp FROM updater"
Dim data As MySqlDataReader
Dim adapter As New MySqlDataAdapter
Dim command As New MySqlCommand
command.CommandText = sqlquery
command.Connection = conn
adapter.SelectCommand = command
data = command.ExecuteReader
Dim vlink As String = ""
Dim dlink As String = ""
Dim ftpu As String = ""
Dim ftpp As String = ""
While data.Read()
If data.HasRows() Then
vlink = data(1).ToString
dlink = data(2).ToString
ftpu = data(3).ToString
ftpp = data(4).ToString
End If
End While
UpdateVB1.checkforupdate(vlink, "0.0.9", dlink, ftpu, ftpp, True)
data.Close()
conn.Close()
Catch ex As Exception
End Try
End Sub[/code2]
My Blog | My Setup | My Videos | Have a wonderful day.


Messages In This Thread
Re: How can I read a link from mysql databse??? - by brandonio21_phpbb3_import2 - 03-24-2013, 10:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I use Listview to delete MySQL DB records kismetgerald 10 32,072 11-28-2012, 05:19 PM
Last Post: brandonio21
  [SOLVED] MySQL Update Query - What am I doing wrong? kismetgerald 11 40,497 10-18-2012, 07:16 PM
Last Post: brandonio21
  How do I fill my form with MySQL data based on Combobox? kismetgerald 8 25,305 10-14-2012, 09:05 PM
Last Post: brandonio21
  Read certain lines brco900033 3 13,959 09-26-2012, 03:56 PM
Last Post: brandonio21
  Read and delete lines brco900033 6 21,376 09-16-2012, 09:38 AM
Last Post: brandonio21
  Help with creating an INSERT statement using MySQL kismetgerald 4 16,002 08-30-2012, 03:03 PM
Last Post: brandonio21
  MySQL Database Issue Moldraxian 7 27,815 08-13-2012, 08:58 PM
Last Post: brandonio21
  MySql Database Queries in VB.Net Moldraxian 6 21,083 07-26-2012, 03:44 PM
Last Post: Moldraxian
  How to Package MySql Connector and MySql Program? Moldraxian 3 14,049 07-20-2012, 12:23 PM
Last Post: brandonio21
  MySql Help Blackrobot 3 13,822 04-06-2012, 03:49 AM
Last Post: xolara

Forum Jump:


Users browsing this thread: 1 Guest(s)