Click here to Skip to main content
15,900,906 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Application Skinning Pin
Christian Graus7-Aug-05 19:14
protectorChristian Graus7-Aug-05 19:14 
GeneralProblem with Listview format Pin
clabrett7-Aug-05 13:59
clabrett7-Aug-05 13:59 
GeneralRe: Problem with Listview format Pin
Rob Graham7-Aug-05 15:19
Rob Graham7-Aug-05 15:19 
GeneralRe: Problem with Listview format Pin
clabrett7-Aug-05 15:48
clabrett7-Aug-05 15:48 
QuestionHow to control printer queue from vb.net Pin
Mekong River7-Aug-05 4:47
Mekong River7-Aug-05 4:47 
AnswerRe: How to control printer queue from vb.net Pin
Rob Graham7-Aug-05 15:39
Rob Graham7-Aug-05 15:39 
GeneralRe: How to control printer queue from vb.net Pin
Mekong River8-Aug-05 7:07
Mekong River8-Aug-05 7:07 
Generali need dynamic query with different criteria Pin
MAGICIANMERLIN7-Aug-05 4:07
MAGICIANMERLIN7-Aug-05 4:07 
Hi, i have a form which has a 1 datagrid and 12 label & textbox(like NAME, SURNAME, NATIONALITY, JOB etc..)and some buttons .I want to get data from database with one or more criteria (User if fill 2 criteria like NAME and SURNAME my query must be where NAME=txtname.text AND SURNAME=txtsurname.text) OR (user maybe fill only one criteria like NAME my query must be where NAME=txtname.text ) or (user maybe want to fill 8 or 6 or all criteria) and if user dont fill any criteria and click get button, query must be (Select * from ANABILGI) thats all..

I try to write a code below but unfortunately it was'nt worked.Would you somebody help me please.



Thanks a lot



Private Sub withcriteria()

Dim param As String = "ADI= txtad.Text & (param1) & SOYADI=txtsoyad.text & (param2)& BABAADI=txtbabaad.text & (param3)& ANAADI=txtanaad.text & (param4)& DYERI=txtdogumyer.text & (param5)& DTARIHI=txtdogumtar.text & (param6)& UYRUK=txtuyruk.text & (param7)& MESLEK=txtmeslek.text & (param8)& DIN=txtdin.text & (param9)& MEDENIHAL=txtmedenihal.text & (param10)& CINSIYET=txtcinsiyet.text & (param11)& TAHSIL=txttahsil.text"

Dim param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11 As String

If txtad.Text.Length And txtsoyad.Text.Length And txtbabaad.Text.Length And txtanaad.Text.Length And txtdogumyer.Text.Length And txtdogumtar.Text.Length And txtuyruk.Text.Length And txtmeslek.Text.Length And txtdin.Text.Length And txtmedenihal.Text.Length And txtcinsiyet.Text.Length And txttahsil.Text.Length < 0 Then

Dim da As New OleDbDataAdapter("Select * from ANABILGI", baglan)

Dim ds As New DataSet

baglan.Open()

da.Fill(ds, "tablo")

DataGrid1.DataSource = ds.Tables("tablo")

baglan.Close()

DataGrid1.Select(DataGrid1.CurrentRowIndex)

Else

If txtad.Text.Length < 0 Then

param1 = "OR"

Else

param1 = "AND"

End If

If txtsoyad.Text.Length < 0 Then

param2 = "OR"

Else

param2 = "AND"

End If

If txtbabaad.Text.Length < 0 Then

param3 = "OR"

Else

param3 = "AND"

End If

If txtanaad.Text.Length < 0 Then

param4 = "OR"

Else

param4 = "AND"

End If

If txtdogumyer.Text.Length < 0 Then

param5 = "OR"

Else

param5 = "AND"

End If

If txtdogumtar.Text.Length < 0 Then

param6 = "OR"

Else

param6 = "AND"

End If

If txtuyruk.Text.Length < 0 Then

param7 = "OR"

Else

param7 = "AND"

End If

If txtmeslek.Text.Length < 0 Then

param8 = "OR"

Else

param8 = "AND"

End If

If txtdin.Text.Length < 0 Then

param9 = "OR"

Else

param9 = "AND"

End If

If txtmedenihal.Text.Length < 0 Then

param10 = "OR"

Else

param10 = "AND"

End If

If txtcinsiyet.Text.Length < 0 Then

param11 = "OR"

Else

param11 = "AND"

End If

End If

Dim da As New OleDbDataAdapter("Select * from ANABILGI where (param)", baglan)

Dim ds As New DataSet

baglan.Open()

da.Fill(ds, "tablo")

DataGrid1.DataSource = ds.Tables("tablo")

baglan.Close()

DataGrid1.Select(DataGrid1.CurrentRowIndex)
GeneralRe: i need dynamic query with different criteria Pin
Christian Graus7-Aug-05 13:56
protectorChristian Graus7-Aug-05 13:56 
GeneralRe: i need dynamic query with different criteria Pin
MAGICIANMERLIN8-Aug-05 10:55
MAGICIANMERLIN8-Aug-05 10:55 
GeneralRe: i need dynamic query with different criteria Pin
Christian Graus8-Aug-05 13:16
protectorChristian Graus8-Aug-05 13:16 
GeneralRichTextBox Pin
SeLoRBIS7-Aug-05 1:49
SeLoRBIS7-Aug-05 1:49 
QuestionHow can get Received value in LocalNetwork Connecttion Pin
Anonymous7-Aug-05 1:45
Anonymous7-Aug-05 1:45 
AnswerRe: How can get Received value in LocalNetwork Connecttion Pin
Dave Kreskowiak7-Aug-05 4:47
mveDave Kreskowiak7-Aug-05 4:47 
GeneralStuck on Getting a Changed Value in a DropDownList within a DataList Pin
asalyon6-Aug-05 15:08
asalyon6-Aug-05 15:08 
GeneralRe: Stuck on Getting a Changed Value in a DropDownList within a DataList Pin
Christian Graus8-Aug-05 19:05
protectorChristian Graus8-Aug-05 19:05 
GeneralDeclarative Security w/ custom principal Pin
Moonark6-Aug-05 11:43
Moonark6-Aug-05 11:43 
GeneralEXECUTENONQUERY Pin
MAGICIANMERLIN6-Aug-05 9:34
MAGICIANMERLIN6-Aug-05 9:34 
GeneralRe: EXECUTENONQUERY Pin
rwestgraham7-Aug-05 17:52
rwestgraham7-Aug-05 17:52 
GeneralRe: EXECUTENONQUERY Pin
MAGICIANMERLIN8-Aug-05 10:51
MAGICIANMERLIN8-Aug-05 10:51 
GeneralRemote system information Pin
Anonymous6-Aug-05 6:11
Anonymous6-Aug-05 6:11 
GeneralRe: Remote system information Pin
Rizwan Bashir8-Aug-05 11:34
Rizwan Bashir8-Aug-05 11:34 
GeneralDatagrid Images Pin
Anonymous6-Aug-05 0:54
Anonymous6-Aug-05 0:54 
GeneralRe: Reports Pin
Anonymous5-Aug-05 23:59
Anonymous5-Aug-05 23:59 
GeneralRe: Reports Pin
Christian Graus7-Aug-05 13:57
protectorChristian Graus7-Aug-05 13:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.