Posted By

alimanam on 07/28/11


Tagged


Versions (?)

تست شماره1


 / Published in: VB.NET
 

این یک تست است

  1. Imports System.Windows.Forms
  2. Imports System.Data
  3. Imports System.Data.SqlClient
  4. Imports System.Data.OleDb
  5.  
  6. Public Class Gavahi_Report
  7.  
  8. Private cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db.mdb")
  9. Private Function SearchByID(ByVal fieldname As String, ByVal Searchfor As Object) As DataTable
  10. Dim ad As New OleDbDataAdapter("Select * from Gavahi Where " & fieldname & " like '%" & Searchfor & "%'", cnn)
  11. Dim dt As New DataTable
  12. ad.Fill(dt)
  13. Return dt
  14. End Function
  15.  
  16. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  17. If TextBox3.Text.Length > 0 Then
  18. Select Case ComboBox2.SelectedIndex
  19. Case Is = 0
  20. DataGridView1.DataSource = SearchByID("ShParvandeh", TextBox3.Text)
  21. Case Is = 1
  22. DataGridView1.DataSource = SearchByID("MalekVakil", TextBox3.Text)
  23. Case Is = 2
  24. DataGridView1.DataSource = SearchByID("MalekVakil", TextBox3.Text)
  25. End Select
  26. End If
  27.  
  28. End Sub
  29.  
  30. Private Sub Gavahi_Report_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  31. DataGridView1.DataSource = SearchByID("ShParvandeh", 1)
  32. End Sub
  33.  
  34.  
  35. End Class

Report this snippet  

You need to login to post a comment.