Friday, March 30, 2012
query question
MySQL = "select DateEntered,Shipper,PickupDate,PUTime,City, State, Zip,
Consignee, Destination, DState, DZip, PickupNumber, ShippersNumber,
PONumber, Consignee_Ref_Number, Weight, Number_Packages, Carrier,
Carrier_Number, Trailer_Number, ApptDate, ApptTime, IDFProNumber,
DeliveredDate, DeliveredTime, FreightCharges, TransitTime, Comments,
LastUpdate, lastcomment from IntermodalTracingMasterFile where " &
tmpMyShippers & " Order by [" & strSort & "] desc "
This works fine.
I need to modify it a little I need to have one query that will return when
the DeliveredDate is empty
and anohter query to return the ones that have somethign in the
DeliveredDate field.
ThanksOn Wed, 17 Nov 2004 15:58:44 -0800, johnfli wrote:
>This is my current query that I have in an App I wrote:
(snip)
>I need to modify it a little I need to have one query that will return when
>the DeliveredDate is empty
>and anohter query to return the ones that have somethign in the
>DeliveredDate field.
Hi johnfli,
Add "WHERE DeliveredDate IS NULL" or "WHERE DeliveredDate IS NOT NULL"
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
query question
MySQL = "select DateEntered,Shipper,PickupDate,PUTime,Ci
ty, State, Zip,
Consignee, Destination, DState, DZip, PickupNumber, ShippersNumber,
PONumber, Consignee_Ref_Number, Weight, Number_Packages, Carrier,
Carrier_Number, Trailer_Number, ApptDate, ApptTime, IDFProNumber,
DeliveredDate, DeliveredTime, FreightCharges, TransitTime, Comments,
LastUpdate, lastcomment from IntermodalTracingMasterFile where " &
tmpMyShippers & " Order by [" & strSort & "] desc "
This works fine.
I need to modify it a little I need to have one query that will return when
the DeliveredDate is empty
and anohter query to return the ones that have somethign in the
DeliveredDate field.
ThanksOn Wed, 17 Nov 2004 15:58:44 -0800, johnfli wrote:
>This is my current query that I have in an App I wrote:
(snip)
>I need to modify it a little I need to have one query that will return when
>the DeliveredDate is empty
>and anohter query to return the ones that have somethign in the
>DeliveredDate field.
Hi johnfli,
Add "WHERE DeliveredDate IS NULL" or "WHERE DeliveredDate IS NOT NULL"
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Wednesday, March 28, 2012
Query problem
I have a count code that works just fine...to get the total..
I need to modify it to select the total where zip = Session("zip")
can anyone help me?
Dim cmd3AsNew Data.SqlClient.SqlCommand("Select count (*) from CustomerInfo", MyConn)
cmd.Connection.Open()
Dim count3AsInteger = cmd3.ExecuteScalar()'this contains the number of records
Label_registeredusers.Text = count3
cmd.Connection.Close()
you can use a parameter in your query to limit the results The parameterized query will be much safer than simply concatenating in the zip code as text in your sql statement as that would expose you to the possibility of a sql injection attack.
Dim paramZipAs New System.Data.SqlClient.SqlParameterparamZip.ParameterName ="@.zip"param.Value = Session("zip")Dim cmd3As New Data.SqlClient.SqlCommand("Select count (*) from CustomerInfo WHERE zip=@.zip", MyConn) cmd3.Parameters.Add(paramZip)cmd.Connection.Open()Dim count3As Integer = cmd3.ExecuteScalar()'this contains the number of recordsLabel_registeredusers.Text = count3cmd.Connection.Close()|||You could do this:
Dim cmd3AsNew Data.SqlClient.SqlCommand("Select count (*) from CustomerInfo WHERE zip = '" & Session("zip") &"'", MyConn)
But it would be better to use command Parameters like :|||
A lot easier than I thought... Thank you very much!
sql