How can I read a link from databse in vb.net
-
I made my software in vb.net and connected it with MySQLDatabse and using phpmyadmin I have create a table update and a column version.... In the version column I have inserted the link of version.txt Now I want that my update library which is updateVB will get the link of version.txt from the databse from that table.... The UpdateVB component strings are:
Updatevb1.checkforupdate("Text file where your version is stated (URL)",
"Current Version",
"URL of executable updater (SFX Archive),
"Username for FTP", "Password for FTP",
showUI As Boolean)I want to get every of these informations like: Text file version URL, current version, URL of executable update etc... I want all the informations to read from the database.... I have tried this in my update.vb:
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 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 While data.Read() If data.HasRows() Then Dim vlink As String = data(1).ToString Dim dlink As String = data(2).ToString Dim ftpu As String = data(3).ToString Dim ftpp As String = data(4).ToString End If End While UpdateVB1.checkforupdate("vlink", "0.0.9", "dlink", "ftpu", "ftpp", showUI:=True) data.Close() conn.Close() Catch ex As Exception End Try End Sub
I used mysqlreader here to get the links...but it doesn't work....
-
I made my software in vb.net and connected it with MySQLDatabse and using phpmyadmin I have create a table update and a column version.... In the version column I have inserted the link of version.txt Now I want that my update library which is updateVB will get the link of version.txt from the databse from that table.... The UpdateVB component strings are:
Updatevb1.checkforupdate("Text file where your version is stated (URL)",
"Current Version",
"URL of executable updater (SFX Archive),
"Username for FTP", "Password for FTP",
showUI As Boolean)I want to get every of these informations like: Text file version URL, current version, URL of executable update etc... I want all the informations to read from the database.... I have tried this in my update.vb:
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 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 While data.Read() If data.HasRows() Then Dim vlink As String = data(1).ToString Dim dlink As String = data(2).ToString Dim ftpu As String = data(3).ToString Dim ftpp As String = data(4).ToString End If End While UpdateVB1.checkforupdate("vlink", "0.0.9", "dlink", "ftpu", "ftpp", showUI:=True) data.Close() conn.Close() Catch ex As Exception End Try End Sub
I used mysqlreader here to get the links...but it doesn't work....
-
Please:
- Post your query in the correct forum.
- Format your code properly and put it inside <pre> tags for readability.
Use the best guess
-
I made my software in vb.net and connected it with MySQLDatabse and using phpmyadmin I have create a table update and a column version.... In the version column I have inserted the link of version.txt Now I want that my update library which is updateVB will get the link of version.txt from the databse from that table.... The UpdateVB component strings are:
Updatevb1.checkforupdate("Text file where your version is stated (URL)",
"Current Version",
"URL of executable updater (SFX Archive),
"Username for FTP", "Password for FTP",
showUI As Boolean)I want to get every of these informations like: Text file version URL, current version, URL of executable update etc... I want all the informations to read from the database.... I have tried this in my update.vb:
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 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 While data.Read() If data.HasRows() Then Dim vlink As String = data(1).ToString Dim dlink As String = data(2).ToString Dim ftpu As String = data(3).ToString Dim ftpp As String = data(4).ToString End If End While UpdateVB1.checkforupdate("vlink", "0.0.9", "dlink", "ftpu", "ftpp", showUI:=True) data.Close() conn.Close() Catch ex As Exception End Try End Sub
I used mysqlreader here to get the links...but it doesn't work....
mnxford wrote:
but it doesn't work....
That's not very descriptive. At the moment, it does not report errors, you're "swallowing" those.
Catch ex As Exception End Try
Remove those lines, and the "try", and it should raise an exception on the place where it goes wrong. In this case, it'd be the SQL-statement; you did not select any columns. Try "SELECT * FROM" or add in the correct column names. I'd also recommend wrapping the Connection, the Command and the Reader in a
USING
statement. Also, it'd be a bit more readable if you called the reader "reader", and not "data". It's not a data-structure, it's a class that fetches information.Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
mnxford wrote:
but it doesn't work....
That's not very descriptive. At the moment, it does not report errors, you're "swallowing" those.
Catch ex As Exception End Try
Remove those lines, and the "try", and it should raise an exception on the place where it goes wrong. In this case, it'd be the SQL-statement; you did not select any columns. Try "SELECT * FROM" or add in the correct column names. I'd also recommend wrapping the Connection, the Command and the Reader in a
USING
statement. Also, it'd be a bit more readable if you called the reader "reader", and not "data". It's not a data-structure, it's a class that fetches information.Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
The no.2 connection is done... But I am not able to do the correction no.1 because I think it is the right section...if not then please move the topic to the right section.....
-
I made my software in vb.net and connected it with MySQLDatabse and using phpmyadmin I have create a table update and a column version.... In the version column I have inserted the link of version.txt Now I want that my update library which is updateVB will get the link of version.txt from the databse from that table.... The UpdateVB component strings are:
Updatevb1.checkforupdate("Text file where your version is stated (URL)",
"Current Version",
"URL of executable updater (SFX Archive),
"Username for FTP", "Password for FTP",
showUI As Boolean)I want to get every of these informations like: Text file version URL, current version, URL of executable update etc... I want all the informations to read from the database.... I have tried this in my update.vb:
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 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 While data.Read() If data.HasRows() Then Dim vlink As String = data(1).ToString Dim dlink As String = data(2).ToString Dim ftpu As String = data(3).ToString Dim ftpp As String = data(4).ToString End If End While UpdateVB1.checkforupdate("vlink", "0.0.9", "dlink", "ftpu", "ftpp", showUI:=True) data.Close() conn.Close() Catch ex As Exception End Try End Sub
I used mysqlreader here to get the links...but it doesn't work....
Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click conn = New MySqlConnection(ServerString) conn.Open() Dim sqlquery As String = "SELECT 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 While data.Read() If data.HasRows() Then Dim vlink As String = data(1).ToString Dim dlink As String = data(2).ToString Dim ftpu As String = data(3).ToString Dim ftpp As String = data(4).ToString End If End While UpdateVB1.checkforupdate("vlink", "0.0.9", "dlink", "ftpu", "ftpp", showUI:=True) data.Close() conn.Close() End Sub
This code should throw an error message 'round your head to get you to a possible solution.
cheers Marco Bertschi
Software Developer & Founder SMGT Web-Portal CP Profile | Twitter | Facebook | SMGT Web-Portal
FizzBuzz - Gary Wheeler
-
mnxford wrote:
I think it is the right section
Your question is about using a Database in VB.NET, both of which have their own forums. This forum is for questions and problems with Visual Studio.
Use the best guess