-- module
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
'Public con As New SqlConnection("Data Source=SIPPVMNAV01;Initial Catalog=zTech_Temp_Pen_20066;Integrated Security=True")
Wednesday, July 5, 2017
sample module in vb.net
-- module
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
'Public con As New SqlConnection("Data Source=SIPPVMNAV01;Initial
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
'Public con As New SqlConnection("Data Source=SIPPVMNAV01;Initial
load combobox | combo box
========== load combobox | combo box
Sub load_combobox()
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
con.Open()
Sub load_combobox()
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
con.Open()
code add to database
=============== code add to database
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
cmd.CommandType = System.Data.CommandType.Text
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
cmd.CommandType = System.Data.CommandType.Text
code click on listview to show data in textbox
====================== code click on listview to show data in textbox
If ListView1.SelectedItems.Count > 0 Then
txtCode.Text = ListView1.Items(ListView1.SelectedIndices(0)).Text
txtModel.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(1).Text
txtYear.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(2).Text
txtPrice.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(3).Text
txtQty.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(4).Text
End If
=========================
If ListView1.SelectedItems.Count > 0 Then
txtCode.Text = ListView1.Items(ListView1.SelectedIndices(0)).Text
txtModel.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(1).Text
txtYear.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(2).Text
txtPrice.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(3).Text
txtQty.Text = ListView1.Items(ListView1.SelectedIndices(0)).SubItems(4).Text
End If
=========================
search
============= search
Dim isSearch As Boolean = False
If txtModel.Text <> "" And txtYear.Text <> "" Then
strQ = "SELECT * FROM tbCar where Model like '%" & txtModel.Text & "%' and Year like '" & txtYear.Text & "' ORDER BY [Model]"
isSearch = True
Dim isSearch As Boolean = False
If txtModel.Text <> "" And txtYear.Text <> "" Then
strQ = "SELECT * FROM tbCar where Model like '%" & txtModel.Text & "%' and Year like '" & txtYear.Text & "' ORDER BY [Model]"
isSearch = True
load data into listview
=========== load data into listview
'strQ = "SELECT * FROM tbCar ORDER BY [Model]"
'======> load_data(strQ)
Sub load_data(sqlQuery As String)
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
'strQ = "SELECT * FROM tbCar ORDER BY [Model]"
'======> load_data(strQ)
Sub load_data(sqlQuery As String)
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
connect or login
============================= connect or login
Private Sub ConnectToSQL()
Dim Password As String
Dim userName As String
Try
If (con.State = ConnectionState.Open) Then
Private Sub ConnectToSQL()
Dim Password As String
Dim userName As String
Try
If (con.State = ConnectionState.Open) Then
Subscribe to:
Posts (Atom)