GlobaLevel
asked on
vb.net dataAdapter - query issue...
I need a query that will:
1) I would like to query a ms sql 2005 db on several tables
2) if columnA = 'x' and columnC = 'y' where id = 1 then this var1 = 'true'
3) if columnc = 'x' and columnd = 'y' where id = 2 then this var2 = 'true'
4) if var1='true' then
run_this_func()
end if
5) if var2='true'then
run_that_func()
heres what I have so faar....i need this ASAP...so any help...
end ifAccept and Award Points Accept as Solution
1) I would like to query a ms sql 2005 db on several tables
2) if columnA = 'x' and columnC = 'y' where id = 1 then this var1 = 'true'
3) if columnc = 'x' and columnd = 'y' where id = 2 then this var2 = 'true'
4) if var1='true' then
run_this_func()
end if
5) if var2='true'then
run_that_func()
heres what I have so faar....i need this ASAP...so any help...
end ifAccept and Award Points Accept as Solution
ASKER
would this work the above????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
does everything else look okay in the code?
ASKER
forgot to post it:
Private Sub VERIFY_CLIENT_RESPONSE_cli
' SO IF THE CLIENT IS STORING THE MASTER FILES TOO BE COPIED
' LETS
Dim client_response As New List(Of String)
Dim client_stores_files As New List(Of String)
Dim dataReader As SqlDataReader
Try
' ---=-=-=-=-=
'
'
' "Data Source=myServerAddress;Ini
Dim x As Integer = 0
Dim sqlConnection As String
Using sqlConn As New SqlConnection
sqlConnection = "Data Source=xx.xx.xx.xx;Initial
sqlConn.ConnectionString = sqlConnection
Dim SQLString As String = "SELECT cr.EMAIL_RESPONSE, cr.color_number, cr.paper_line, pt.product_weight, pt.paper_legal FROM CLIENT_RESPONSE cr JOIN paper_table pt ON pt.client_id = cr.client_id WHERE server_name=" & server_name & _
"and P_NAME = " & P_NAME & "ORDER BY cr.email_response asc, cr.color_number asc,cr.paper_line asc"
' Dim dataReader As SqlDataReader
sqlConn.Open()
Using command As New SqlCommand(SQLString, sqlConn)
dataReader = command.ExecuteReader(Comm
Do While dataReader.Read()
client_response.Add(dataRe
Loop
'-------------------------
' SORT TO DATAVIEW...THEN FEED INTO VARIABLES TO BE USED LATER....
' NOT GOOD TO KEEP CONNECTION OPEN FOR TOO LONG
' IF COLUMN = 'THIS' THEN FEED INTO VARAIBLE
' BECAUSE SIMILIAR VALUES EXIST IN DIFFERENT COLUMNS
Dim dt As DataTable
Dim myDataView As DataView
dt.Load(dataReader)
myDataView = dt.DefaultView
myDataView.Sort = "color_number DESC"
if dt.cr.paper_line = "y" and dt.cr.EMAIL_RESPONSE = "y" then
dim client_response_wants_lega
dt = client_response_wants_lega
end if
if dt.cr.color_number = "y" and dt.cr.vm_RESPONSE = "y" then
dim client_vm_wants_red_paper as string
dt = client_vm_wants_red_paper
end if
if dt.pt.product_weight = "y" and dt.cr.vm_RESPONSE = "y" then
dim client_vm_wants_weighted_p
dt = client_vm_wants_weighted_p
end if
'-------------------------
dataReader.Close()
sqlConn.Close()
End Using
End Using
'Retrieve the number of record.
x = client_response.Count
MsgBox("CLIENT FILE PATHS ARE NOT FOUND...")
'UsernameTextBox.Focus()
'-------------------------
'
' NOW THAT THE VARAIBLES HAVE BEEN SET...
' IF IT EXISTS...REDIRECT TO ANOTHER FUNCTION IN THE PROGRAM..
If client_response_wants_lega
switch_paper_to8_x _14()
End If
If client_vm_wants_red_paper <> "" Then
switch_color_to_red()
End If
If client_vm_wants_weighted_p
switch_paper_to_weighted()
End If
Catch ex As FileNotFoundException
Catch ex As Exception
MessageBox.Show("Please reJECT: DL ISSUE_sql connection....BODY: ERROR: " + ex.Message)
End Try
End Sub