Acak nomer dari mysql vb.net

Hey guys I want to extract a certain value from by database's table IF a condition is met. My table has the following http://prntscr.com/38hpry

My textbox1.text = eddye, for example and my second textbox will be the place where my URL will be stored

** I don't have a quite exact idea on how to use the select properly

        Dim SqlQuery As String = "SELECT users1.username, users1.onedrive From users1 WHERE username = @Username"

Dim Command As New MySqlCommand(SqlQuery, MySQLConnection)

  • Sanitizer Command.Parameters.Add(New MySqlParameter("@Username", TextBox1.Text))

       Data Reader:
    

    dbCon.Open()

        DR = SQLCmd.ExecuteReader
    
        While DR.Read
            textbox2.text = textbox2.text & DR.Item("onedrive")
    
        End While
    

Can you guys help me? I have the basic Idea in mind, but It's incomplete and I am sure my select/parameter_sanitizer is wrong, Thanks

asked Apr 9, 2014 at 19:19

ExtremeSwatExtremeSwat

7831 gold badge11 silver badges34 bronze badges

3

You are on the right path, and the parameterized query seems to be correct, however some other code is missing. You need to open a connection to your database and associate the MySqlCommand to the connection

  Dim SqlQuery As String = "SELECT users1.username, users1.onedrive " & _
                           "From users1 WHERE username = @Username"
  Using con = new MySqlConnection(connectionString)
  Using SQLcmd = new MySqlCommand(SqlQuery, con)
      con.Open()
      SQLCmd.Parameters.Add(New MySqlParameter("@Username", TextBox1.Text))
      Using DR = SQLCmd.ExecuteReader
         While DR.Read
            textbox2.text = textbox2.text & DR.Item("onedrive")
         End While
      End Using
 End Using
 End Using

Perhaps you could just change the line that build the parameter with a simple

 SQLCmd.Parameters.AddWithValue("@Username", TextBox1.Text)

The only real improvement that you could do is the Using Statement that encloses every disposable object used in your code. This statement allows a correct closing and disposing of the connection and the other objects involved (also in case of Exceptions)

answered Apr 9, 2014 at 19:27

Acak nomer dari mysql vb.net

SteveSteve

210k21 gold badges223 silver badges279 bronze badges

4

Not the answer you're looking for? Browse other questions tagged mysql vb.net or ask your own question.

Hamdhana, Defry and Fachrurrazi, Sayed (2013) Replikasi Standby Database Menggunakan Metode Incremental Back Up. Jurnal Energi Elektrik, II. ISSN 2086 - 5635

Abstract

Penelitian ini membahas tentang metode yang dapat diterapkan pada sebuah sistem server database (primary) untuk melakukan replikasi secara incremental backup dan selalu tersinkronisasi pada server database cadangan (standby database). Standby database mengaktifkan failover ketika server primary database mengalami failure (kerusakan). Sehingga standby database menjadi primary database yang baru. Pada simulasi ini aplikasi dibangun dengan menggunakan VB.Net dan MySQL Front. Serta menggunakan data sampel acak yang penulis unduh dari internet. Aplikasi terdiri atas 2 bagian. Yang pertama berupa aplikasi pergudangan yang berada pada komputer klien (admin), dan yang kedua berupa aplikasi master yang berada pada server primary database. Hasil dari simulasi ini adalah melakukan pembuktian terhadap replikasi yang terjadi antara primary database dengan standby database secara realtime. Dan aktifnya failover yang membuat standby database menjadi primary database yang baru saat primary database mengalami kerusakan. Sehingga transaksi data yang dilakukan oleh klien (admin) dapat berjalan dengan normal. Keywords— Primary Database, Standby Database, Incremental Backup, Failover

Item Type: Article
Subjects:T Technology & Engineering > TI Informatics, Information System > Database
Divisions:Faculty of Engineering > Department of Informatics
Depositing User: Mr Defry Hamdhana
Date Deposited:18 Jan 2016 04:27
Last Modified:11 Mar 2016 06:14
URI:http://repository.unimal.ac.id/id/eprint/579

Actions (login required)

Acak nomer dari mysql vb.net
View Item