/ Published in: VB.NET
این یک تست است
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Imports System.Windows.Forms Imports System.Data Imports System.Data.SqlClient Imports System.Data.OleDb Public Class Gavahi_Report Private cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db.mdb") Private Function SearchByID(ByVal fieldname As String, ByVal Searchfor As Object) As DataTable Dim ad As New OleDbDataAdapter("Select * from Gavahi Where " & fieldname & " like '%" & Searchfor & "%'", cnn) Dim dt As New DataTable ad.Fill(dt) Return dt End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox3.Text.Length > 0 Then Select Case ComboBox2.SelectedIndex Case Is = 0 DataGridView1.DataSource = SearchByID("ShParvandeh", TextBox3.Text) Case Is = 1 DataGridView1.DataSource = SearchByID("MalekVakil", TextBox3.Text) Case Is = 2 DataGridView1.DataSource = SearchByID("MalekVakil", TextBox3.Text) End Select End If End Sub Private Sub Gavahi_Report_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.DataSource = SearchByID("ShParvandeh", 1) End Sub End Class