Hello I wanna asking, i have a database ( online ) which have a 3 table ( Name, Link, Status )

I wanna ask how to :
Check Name Data is it Same with the TextBox1? if it same check the status data is it "A" for Active or "N" for NonActive if it "A", Lable1.Text will be show the Link data

Can you give me the code to make that happen? thanks

What have you done so far? Is it the SQL for the query you are having trouble with or the whole connection thing? For clarity, what is your table schema like? Are all three tables linked by the same foreign key?

@hericles well, i already put connection into data but i don't know how to Insert Database Data into Lable.

Here is my code :

MySQLConnection = New MySqlConnection
        MySQLConnection.ConnectionString = "server='mysqlserver;Port=3306; User ID='user; password='user; database='user"
        MySQLConnection.Open()
        Dim MyAdapter As New MySqlDataAdapter
        Dim SqlQuary = "INSERT INTO VALUES (Lable2.Text) TVD(Link)"
        Dim Command As New MySqlCommand
        Command.Connection = MySQLConnection
        Command.CommandText = SqlQuary
      MyAdapter.SelectCommand = Command
        Dim Mydata As MySqlDataReader
        Mydata = Command.ExecuteReader
        If Mydata.HasRows = 0 Then
            MsgBox("Error! The Data is Not Found")
        Else

        End If

I describe it on the image here :
Explain Image 1
Explain Image 2
Hope you all can help me, thanks

So you are trying to insert the text from the label into the database.
Change your code to this:

Dim SqlQuary = "INSERT INTO table_name VALUES(?label)"   // I'm not sure what //TVD refers to, is it the table name?
Dim Command As New MySqlCommand
Command.Connection = MySQLConnection
Command.CommandText = SqlQuary
Command.Parameters.Add("?label", MySqlDataType.Varchar);
Command.Parameters["?label"].Value = Label2.Text;

@hericles
No No i try to insert data from database into lable, please see my Explain Image 2

I see. Your SQL code has an INSERT statement in it...
In that case you want to use something like
string sql = "SELECT * FROM table_name WHERE some criteria";

Then execute your command and store the result in a string. Set the label text to the string value.

You should not be doing an insert then , you're trying to fetch data fro the table to display it on a label. Use your SELECT Statements as clearly stated by hericles.

This article has been dead for over six months. Start a new discussion instead.