7/29/2014

SqlConnection connection = new SqlConnection(Program.C);
connection.Open();
string cmdText = "Update table1 set rate=@rate,qty=@qty,total=@total where id=@id";
SqlCommand command = new SqlCommand(cmdText, connection);
command.Parameters.AddWithValue("rate", rate);
command.Parameters.AddWithValue("qty", qty);
command.Parameters.AddWithValue("total", total);
command.Parameters.AddWithValue("id", id);
command.ExecuteNonQuery();
connection.Close();

Posted on Tuesday, July 29, 2014 by nuyingnaja

7/07/2014

Imports MySql.Data.MySqlClient

Public Class clsConnecetion
    Public ConMy As MySqlConnection = New MySqlConnection

    'Dim Hostname As String = "172.00.00.000"
    'Dim DBName As String = "XXX"
    'Dim SID As String = "admin"
    'Dim Password As String = "1234567890"

    Public Sub ConnectOpen()
        ConMy.Close()
        Try
            With ConMy
                If .State = ConnectionState.Open Then .Close()
                .ConnectionString = "Data Source=" & Hostname & ";Database=" & DBName & ";User ID=" & SID & ";Password=" & Password & ";CharSet=tis620"
                .Open()
            End With
        Catch ex As Exception
        End Try
    End Sub

    Public Sub ConnectClose()
        Try
            ConMy.Close()
        Catch ex As Exception
        End Try
    End Sub

End Class

Posted on Monday, July 07, 2014 by nuyingnaja