473,728 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP Syntax using Variable for DropDownList1 as criteria in Pervasive SQL query

Hi all.

I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.

SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')

I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the value of
DropDownList1

SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")

I have been searching for the propoer syntax and have been unable to
get it functioning properly.

Thank you!

May 5 '07 #1
7 2885
On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:
Hi all.

I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.

SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')

I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the value of
DropDownList1

SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")

I have been searching for the propoer syntax and have been unable to
get it functioning properly.

Thank you!
I think

<asp:SqlDataSou rce
....
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>

May 5 '07 #2
On May 5, 3:32 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:


Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')
I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the value of
DropDownList1
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")
I have been searching for the propoer syntax and have been unable to
get it functioning properly.
Thank you!

I think

<asp:SqlDataSou rce
...
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>- Hide quoted text -

- Show quoted text -
Thanks for the reply.

Here is the code that works and displays one record based on the
definitive ...WHERE OE_HDR.ORD_NO= '140173'">

<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= '140173'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>

</asp:SqlDataSour ce>
When I change the code to use the variable:

<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @DropDownList2" >
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>

</asp:SqlDataSour ce>
I get this error in my page:

ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>>DropDownLis t2
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.Odb c.OdbcException : ERROR [42000]
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine
Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>>DropDownLis t2
Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.

Stack Trace:
[OdbcException (0x80131937): ERROR [42000] [Pervasive][ODBC Client
Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT
OE_HDR.ORD_NO, OE_HDR.CUST_NAM , OE_HDR.SLS_MAN_ NO,
OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT, OE_HDR.SHIP_DAT FROM OE_HDR
WHERE OE_HDR.ORD_NO=@ << ??? >>DropDownLis t2]
System.Data.Odb c.OdbcConnectio n.HandleError(O dbcHandle hrHandle,
RetCode retcode) +35
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader, Object[] methodArguments ,
SQL_API odbcApiMethod) +1735
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader) +60
System.Data.Odb c.OdbcCommand.E xecuteReader(Co mmandBehavior
behavior) +75
System.Data.Odb c.OdbcCommand.E xecuteDbDataRea der(CommandBeha vior
behavior) +4

System.Data.Com mon.DbCommand.S ystem.Data.IDbC ommand.ExecuteR eader(CommandBe havior
behavior) +7
System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, String
srcTable) +83

System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect(Da taSourceSelectA rguments
arguments) +1770
System.Web.UI.D ataSourceView.S elect(DataSourc eSelectArgument s
arguments, DataSourceViewS electCallback callback) +17
System.Web.UI.W ebControls.Data BoundControl.Pe rformSelect() +149
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Grid View.DataBind() +4
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
+82

System.Web.UI.W ebControls.Comp ositeDataBoundC ontrol.CreateCh ildControls()
+69
System.Web.UI.C ontrol.EnsureCh ildControls() +87
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +41
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+1360


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
ASP.NET Version:2.0.507 27.42
Any Ideas?
Thanks again for you help.

May 5 '07 #3
On May 5, 7:16 pm, bry...@4dnssupp ort.com wrote:
On May 5, 3:32 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :


On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:
Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')
I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the value of
DropDownList1
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")
I have been searching for the propoer syntax and have been unable to
get it functioning properly.
Thank you!
I think
<asp:SqlDataSou rce
...
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>- Hide quoted text -
- Show quoted text -

Thanks for the reply.

Here is the code that works and displays one record based on the
definitive ...WHERE OE_HDR.ORD_NO= '140173'">

<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= '140173'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>

</asp:SqlDataSour ce>

When I change the code to use the variable:

<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @DropDownList2" >
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>

</asp:SqlDataSour ce>

I get this error in my page:

ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???>>DropDownLi st2

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.Odb c.OdbcException : ERROR [42000]
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine
Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>DropDownList 2

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.

Stack Trace:

[OdbcException (0x80131937): ERROR [42000] [Pervasive][ODBC Client
Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT
OE_HDR.ORD_NO, OE_HDR.CUST_NAM , OE_HDR.SLS_MAN_ NO,
OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT, OE_HDR.SHIP_DAT FROM OE_HDR
WHERE OE_HDR.ORD_NO=@ << ??? >>DropDownLis t2]
System.Data.Odb c.OdbcConnectio n.HandleError(O dbcHandle hrHandle,
RetCode retcode) +35
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader, Object[] methodArguments ,
SQL_API odbcApiMethod) +1735
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader) +60
System.Data.Odb c.OdbcCommand.E xecuteReader(Co mmandBehavior
behavior) +75
System.Data.Odb c.OdbcCommand.E xecuteDbDataRea der(CommandBeha vior
behavior) +4

System.Data.Com mon.DbCommand.S ystem.Data.IDbC ommand.ExecuteR eader(CommandBe *havior
behavior) +7
System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, String
srcTable) +83

System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect(Da taSourceSelectA *rguments
arguments) +1770
System.Web.UI.D ataSourceView.S elect(DataSourc eSelectArgument s
arguments, DataSourceViewS electCallback callback) +17
System.Web.UI.W ebControls.Data BoundControl.Pe rformSelect() +149
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Grid View.DataBind() +4
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
+82

System.Web.UI.W ebControls.Comp ositeDataBoundC ontrol.CreateCh ildControls()
+69
System.Web.UI.C ontrol.EnsureCh ildControls() +87
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +41
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+1360

---------------------------------------------------------------------------*-----
Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
ASP.NET Version:2.0.507 27.42

Any Ideas?
Thanks again for you help.- Hide quoted text -

- Show quoted text -
wait... I made a misspelling, don't you see it?

<asp:ControlPar ameter
ControlID="Drop DownList2"
Name="DropDownL ist2"

Name should be a name of the db-field, e.g. ORD_NO

May 5 '07 #4
On May 5, 2:36 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:16 pm, bry...@4dnssupp ort.com wrote:


On May 5, 3:32 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:
Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')
I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the valueof
DropDownList1
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")
I have been searching for the propoer syntax and have been unable to
get it functioning properly.
Thank you!
I think
<asp:SqlDataSou rce
...
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>- Hide quoted text -
- Show quoted text -
Thanks for the reply.
Here is the code that works and displays one record based on the
definitive ...WHERE OE_HDR.ORD_NO= '140173'">
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= '140173'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
When I change the code to use the variable:
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @DropDownList2" >
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
I get this error in my page:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???>>DropDownLi st2
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.Odb c.OdbcException : ERROR [42000]
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine
Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>>DropDownLis t2
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[OdbcException (0x80131937): ERROR [42000] [Pervasive][ODBC Client
Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT
OE_HDR.ORD_NO, OE_HDR.CUST_NAM , OE_HDR.SLS_MAN_ NO,
OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT, OE_HDR.SHIP_DAT FROM OE_HDR
WHERE OE_HDR.ORD_NO=@ << ??? >>DropDownLis t2]
System.Data.Odb c.OdbcConnectio n.HandleError(O dbcHandle hrHandle,
RetCode retcode) +35
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader, Object[] methodArguments ,
SQL_API odbcApiMethod) +1735
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader) +60
System.Data.Odb c.OdbcCommand.E xecuteReader(Co mmandBehavior
behavior) +75
System.Data.Odb c.OdbcCommand.E xecuteDbDataRea der(CommandBeha vior
behavior) +4
System.Data.Com mon.DbCommand.S ystem.Data.IDbC ommand.ExecuteR eader(CommandBe **havior
behavior) +7
System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, String
srcTable) +83
System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect(Da taSourceSelectA **rguments
arguments) +1770
System.Web.UI.D ataSourceView.S elect(DataSourc eSelectArgument s
arguments, DataSourceViewS electCallback callback) +17
System.Web.UI.W ebControls.Data BoundControl.Pe rformSelect() +149
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Grid View.DataBind() +4
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
+82
System.Web.UI.W ebControls.Comp ositeDataBoundC ontrol.CreateCh ildControls()
+69
System.Web.UI.C ontrol.EnsureCh ildControls() +87
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +41
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+1360
---------------------------------------------------------------------------**-----
Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
ASP.NET Version:2.0.507 27.42
Any Ideas?
Thanks again for you help.- Hide quoted text -
- Show quoted text -

wait... I made a misspelling, don't you see it?

<asp:ControlPar ameter
ControlID="Drop DownList2"
Name="DropDownL ist2"

Name should be a name of the db-field, e.g. ORD_NO- Hide quoted text -

- Show quoted text -
I changed to name to ORD_NO and also changed the query to reflect that
change:

<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @ORD_NO">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2" Name="ORD_NO"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>

Same Error now except the last error now references ORD_NO

ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @<< ??? >>ORD_NO

I am wondering if this is not more of a PervasiveSQL problem with the
syntax of the variable rather than an ASP qestion...

May 6 '07 #5
On May 6, 4:46 am, bry...@4dnssupp ort.com wrote:
On May 5, 2:36 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :


On May 5, 7:16 pm, bry...@4dnssupp ort.com wrote:
On May 5, 3:32 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:
Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')
I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the value of
DropDownList1
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")
I have been searching for the propoer syntax and have been unableto
get it functioning properly.
Thank you!
I think
<asp:SqlDataSou rce
...
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>- Hide quoted text -
- Show quoted text -
Thanks for the reply.
Here is the code that works and displays one record based on the
definitive ...WHERE OE_HDR.ORD_NO= '140173'">
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= '140173'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
When I change the code to use the variable:
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @DropDownList2" >
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
I get this error in my page:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???>>DropDownLi st2
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.Odb c.OdbcException : ERROR [42000]
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine
Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>DropDownList 2
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[OdbcException (0x80131937): ERROR [42000] [Pervasive][ODBC Client
Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT
OE_HDR.ORD_NO, OE_HDR.CUST_NAM , OE_HDR.SLS_MAN_ NO,
OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT, OE_HDR.SHIP_DAT FROM OE_HDR
WHERE OE_HDR.ORD_NO=@ << ??? >>DropDownLis t2]
System.Data.Odb c.OdbcConnectio n.HandleError(O dbcHandle hrHandle,
RetCode retcode) +35
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader, Object[] methodArguments ,
SQL_API odbcApiMethod) +1735
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader) +60
System.Data.Odb c.OdbcCommand.E xecuteReader(Co mmandBehavior
behavior) +75
System.Data.Odb c.OdbcCommand.E xecuteDbDataRea der(CommandBeha vior
behavior) +4
System.Data.Com mon.DbCommand.S ystem.Data.IDbC ommand.ExecuteR eader(CommandBe ***havior
behavior) +7
System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, String
srcTable) +83
System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect(Da taSourceSelectA ***rguments
arguments) +1770
System.Web.UI.D ataSourceView.S elect(DataSourc eSelectArgument s
arguments, DataSourceViewS electCallback callback) +17
System.Web.UI.W ebControls.Data BoundControl.Pe rformSelect() +149
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Grid View.DataBind() +4
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
+82
System.Web.UI.W ebControls.Comp ositeDataBoundC ontrol.CreateCh ildControls()
+69
System.Web.UI.C ontrol.EnsureCh ildControls() +87
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +41
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+1360
---------------------------------------------------------------------------***-----
Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
ASP.NET Version:2.0.507 27.42
Any Ideas?
Thanks again for you help.- Hide quoted text -
- Show quoted text -
wait... I made a misspelling, don't you see it?
<asp:ControlPar ameter
ControlID="Drop DownList2"
Name="DropDownL ist2"
Name should be a name of the db-field, e.g. ORD_NO- Hide quoted text -
- Show quoted text -

I changed to name to ORD_NO and also changed the query to reflect that
change:

<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @ORD_NO">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2" Name="ORD_NO"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>

Same Error now except the last error now references ORD_NO

ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @<< ??? >>ORD_NO

I am wondering if this is not more of a PervasiveSQL problem with the
syntax of the variable rather than an ASP qestion...- Hide quoted text -

- Show quoted text -
Please post here a code of the DropDownList Control and its
SqlDataSource.

It looks a little bit strange, you received the same ODBC-error when
the Name property was not defined at all. I'm curious if you defined
it properly...

May 6 '07 #6
On May 6, 11:19 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 6, 4:46 am, bry...@4dnssupp ort.com wrote:


On May 5, 2:36 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:16 pm, bry...@4dnssupp ort.com wrote:
On May 5, 3:32 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:
Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')
I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references the value of
DropDownList1
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")
I have been searching for the propoer syntax and have been unable to
get it functioning properly.
Thank you!
I think
<asp:SqlDataSou rce
...
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>- Hide quoted text -
- Show quoted text -
Thanks for the reply.
Here is the code that works and displays one record based on the
definitive ...WHERE OE_HDR.ORD_NO= '140173'">
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me%>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= '140173'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
When I change the code to use the variable:
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me%>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @DropDownList2" >
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
I get this error in my page:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???>>DropDownLi st2
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.Odb c.OdbcException : ERROR [42000]
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine
Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>>DropDownLis t2
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[OdbcException (0x80131937): ERROR [42000] [Pervasive][ODBC Client
Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT
OE_HDR.ORD_NO, OE_HDR.CUST_NAM , OE_HDR.SLS_MAN_ NO,
OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT, OE_HDR.SHIP_DAT FROM OE_HDR
WHERE OE_HDR.ORD_NO=@ << ??? >>DropDownLis t2]
System.Data.Odb c.OdbcConnectio n.HandleError(O dbcHandle hrHandle,
RetCode retcode) +35
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader, Object[] methodArguments ,
SQL_API odbcApiMethod) +1735
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader) +60
System.Data.Odb c.OdbcCommand.E xecuteReader(Co mmandBehavior
behavior) +75
System.Data.Odb c.OdbcCommand.E xecuteDbDataRea der(CommandBeha vior
behavior) +4
System.Data.Com mon.DbCommand.S ystem.Data.IDbC ommand.ExecuteR eader(CommandBe ****havior
behavior) +7
System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, String
srcTable) +83
System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect(Da taSourceSelectA ****rguments
arguments) +1770
System.Web.UI.D ataSourceView.S elect(DataSourc eSelectArgument s
arguments, DataSourceViewS electCallback callback) +17
System.Web.UI.W ebControls.Data BoundControl.Pe rformSelect() +149
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Grid View.DataBind() +4
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
+82
System.Web.UI.W ebControls.Comp ositeDataBoundC ontrol.CreateCh ildControls()
+69
System.Web.UI.C ontrol.EnsureCh ildControls() +87
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +41
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+1360
---------------------------------------------------------------------------****-----
Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
ASP.NET Version:2.0.507 27.42
Any Ideas?
Thanks again for you help.- Hide quoted text -
- Show quoted text -
wait... I made a misspelling, don't you see it?
<asp:ControlPar ameter
ControlID="Drop DownList2"
Name="DropDownL ist2"
Name should be a name of the db-field, e.g. ORD_NO- Hide quoted text -
- Show quoted text -
I changed to name to ORD_NO and also changed the query to reflect that
change:
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @ORD_NO">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2" Name="ORD_NO"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
Same Error now except the last error now references ORD_NO
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @<< ??? >>ORD_NO
I am wondering if this is not more of a PervasiveSQL problem with the
syntax of the variable rather than an ASP qestion...- Hide quoted text -
- Show quoted text -

Please post here a code of the DropDownList Control and its
SqlDataSource.

It looks a little bit strange, you received the same ODBC-error when
the Name property was not defined at all. I'm curious if you defined
it properly...- Hide quoted text -

- Show quoted text -
I got it working!

You should specify your parameter as the following:

.....WHERE ORD_NO = ?"

The reason is simple: this is an ODBC provider, and in the
SqlDataSource Control it supports only positional parameters
identified by the "?" character, and not a named parameters with "@".

Source: http://msdn2.microsoft.com/en-us/lib...ad(VS.80).aspx

Example (works at my box):

<%@ Page Language="C#" %>
<html>
<head id="Head1" runat="server">
<title>Test</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownLi st ID="DropDownLis t1"
DataSourceID="S qlDataSource2" AutoPostBack="t rue"
DataTextField=" Type" Runat="server" />
<asp:SqlDataSou rce ID="SqlDataSour ce2" Runat="server"
SelectCommand=" select distinct Type from Room"
ConnectionStrin g="Dsn=DEMODATA "
ProviderName="S ystem.Data.Odbc " />
<br />
<asp:GridView ID="GridView1" Runat="server"
DataSourceID="S qlDataSource1"
AutoGenerateCol umns="True">
</asp:GridView>
<asp:SqlDataSou rce ID="SqlDataSour ce1" Runat="server"
SelectCommand=" select top 10 building_name, number, capacity
from Room where type=?"
ConnectionStrin g="Dsn=DEMODATA "
ProviderName="S ystem.Data.Odbc ">
<SelectParamete rs>
<asp:ControlPar ameter Name="Type" ControlID="Drop DownList1" /
>
</SelectParameter s>
</asp:SqlDataSour ce>
</form>
</body>
</html>

Enjoy :-)

May 6 '07 #7
On May 6, 8:01 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 6, 11:19 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :


On May 6, 4:46 am, bry...@4dnssupp ort.com wrote:
On May 5, 2:36 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:16 pm, bry...@4dnssupp ort.com wrote:
On May 5, 3:32 am, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 5, 7:09 am, bry...@4dnssupp ort.com wrote:
Hi all.
I am new to ASP and working in Expression Web. The followingquery
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"='174310')
I also have DropDownList1 working properly. For the WHERE portion of
the query I would like to pass a variable that references thevalue of
DropDownList1
SELECT "OE_HDR"."ORD_N O", "OE_HDR"."CUST_ NAM", "OE_HDR"."SLS_M AN_NO",
"OE_HDR"."SLS_M AN_INITIALS", "OE_HDR"."ORD_D AT", "OE_HDR"."SHIP_ DAT"
FROM "OE_HDR" WHERE ("OE_HDR"."ORD_ NO"= @"DropDownList1 ")
I have been searching for the propoer syntax and have been unable to
get it functioning properly.
Thank you!
I think
<asp:SqlDataSou rce
...
WHERE OE_HDR.ORD_NO = @DropDownList1
">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="DropDownL ist1"
PropertyName="S electedValue" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>- Hide quoted text -
- Show quoted text -
Thanks for the reply.
Here is the code that works and displays one record based on the
definitive ...WHERE OE_HDR.ORD_NO= '140173'">
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= '140173'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
When I change the code to use the variable:
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @DropDownList2" >
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2"
Name="DropDownL ist2"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
I get this error in my page:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???>>DropDownLi st2
Description: An unhandled exception occurred during the executionof
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.Odb c.OdbcException : ERROR [42000]
[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine
Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO=@ << ???
>DropDownList 2
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace
below.
Stack Trace:
[OdbcException (0x80131937): ERROR [42000] [Pervasive][ODBC Client
Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT
OE_HDR.ORD_NO, OE_HDR.CUST_NAM , OE_HDR.SLS_MAN_ NO,
OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT, OE_HDR.SHIP_DAT FROM OE_HDR
WHERE OE_HDR.ORD_NO=@ << ??? >>DropDownLis t2]
System.Data.Odb c.OdbcConnectio n.HandleError(O dbcHandle hrHandle,
RetCode retcode) +35
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader, Object[] methodArguments ,
SQL_API odbcApiMethod) +1735
System.Data.Odb c.OdbcCommand.E xecuteReaderObj ect(CommandBeha vior
behavior, String method, Boolean needReader) +60
System.Data.Odb c.OdbcCommand.E xecuteReader(Co mmandBehavior
behavior) +75
System.Data.Odb c.OdbcCommand.E xecuteDbDataRea der(CommandBeha vior
behavior) +4
System.Data.Com mon.DbCommand.S ystem.Data.IDbC ommand.ExecuteR eader(CommandBe *****havior
behavior) +7
System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) +141
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +137
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, String
srcTable) +83
System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect(Da taSourceSelectA *****rguments
arguments) +1770
System.Web.UI.D ataSourceView.S elect(DataSourc eSelectArgument s
arguments, DataSourceViewS electCallback callback) +17
System.Web.UI.W ebControls.Data BoundControl.Pe rformSelect() +149
System.Web.UI.W ebControls.Base DataBoundContro l.DataBind() +70
System.Web.UI.W ebControls.Grid View.DataBind() +4
System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
+82
System.Web.UI.W ebControls.Comp ositeDataBoundC ontrol.CreateCh ildControls()
+69
System.Web.UI.C ontrol.EnsureCh ildControls() +87
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +41
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.C ontrol.PreRende rRecursiveInter nal() +161
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
+1360
---------------------------------------------------------------------------*****-----
Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
ASP.NET Version:2.0.507 27.42
Any Ideas?
Thanks again for you help.- Hide quoted text -
- Show quoted text -
wait... I made a misspelling, don't you see it?
<asp:ControlPar ameter
ControlID="Drop DownList2"
Name="DropDownL ist2"
Name should be a name of the db-field, e.g. ORD_NO- Hide quoted text -
- Show quoted text -
I changed to name to ORD_NO and also changed the query to reflect that
change:
<asp:SqlDataSou rce runat="server" ID="SqlDataSour ce2"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
ProviderName="< %$ ConnectionStrin gs:ConnectionSt ring.ProviderNa me %>"
SelectCommand=" SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @ORD_NO">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList2" Name="ORD_NO"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
Same Error now except the last error now references ORD_NO
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC
Engine Interface]Syntax Error: SELECT OE_HDR.ORD_NO, OE_HDR.CUST_NAM ,
OE_HDR.SLS_MAN_ NO, OE_HDR.SLS_MAN_ INITIALS, OE_HDR.ORD_DAT,
OE_HDR.SHIP_DAT FROM OE_HDR WHERE OE_HDR.ORD_NO= @<< ??? >>ORD_NO
I am wondering if this is not more of a PervasiveSQL problem with the
syntax of the variable rather than an ASP qestion...- Hide quoted text -
- Show quoted text -
Please post here a code of the DropDownList Control and its
SqlDataSource.
It looks a little bit strange, you received the same ODBC-error when
the Name property was not defined at all. I'm curious if you defined
it properly...- Hide quoted text -
- Show quoted text -

I got it working!

You should specify your parameter as the following:

....WHERE ORD_NO = ?"

The reason is simple: this is an ODBC provider, and in the
SqlDataSource Control it supports only positional parameters
identified by the "?" character, and not a named parameters with "@".

Source:http://msdn2.microsoft.com/en-us/lib...ad(VS.80).aspx

Example (works at my box):

<%@ Page Language="C#" %>
<html>
<head id="Head1" runat="server">
<title>Test</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownLi st ID="DropDownLis t1"
DataSourceID="S qlDataSource2" AutoPostBack="t rue"
DataTextField=" Type" Runat="server" />
<asp:SqlDataSou rce ID="SqlDataSour ce2"
...

read more »- Hide quoted text -

- Show quoted text -
Thank you! That works perfectly. Thanks for helping me over my first
asp hurdle. :)

May 6 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
34030
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
2
2535
by: Matthew | last post by:
Hey , I have built a query which takes values from unbounded fields on a form, and it all works except for one thing. I have a few fields in my query that are dates. I also have a start and end date and time on my form. So, a user will specify the start and end date, and also, the user has the option of checking which of the time fields from the query will have these dates as criteria. So, one of the date fields in my query is...
2
6163
by: Joe Molloy | last post by:
Hi, This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious. I have developed a shopping cart for an application I'm working on which is loosely based on the e-commerce example in the quickstarts tutorial. In the cart display I have provided functionality so that when a user clicks on a product name a popup is opened with the full product details displayed.
7
6348
by: kaosyeti | last post by:
hey.. i have a control in a report that needs to count the records from a table that match the parameters that the user selects when creating the report. the report is created with formquerybuilder and the parameters are department, upsource, and date. i can't get the syntax down for this dcount: =DCount("*","tblcontactdata"," Between #" & & "# And #" & & "#" & "' AND '" & "'='" & "'forms! formquerybuilder!cboxupsource'" & "' AND '"...
2
2037
by: Sagaert Johan | last post by:
Hi I try to use this as sql string ( The field i compare with is variable. ) "SELECT * FROM FMatrix WHERE @wantedfield=@criteria" i use the Parameters.Add with OleDbType.WChar . Why can't i specify the field i want to use as a parameter ?
33
7657
by: Birky | last post by:
Can you please help me understand how to build Criteria syntax within the Query Builder? If you have a field that is for a region (lets say for Midwest) and you have another field which breaks it down into a smaller geographical region like City (lets say Denver) how can I build the Criteria within the Query Builder to key off a previous select field to narrow down the location? If region Midwest is select within region...
16
2449
by: Chuck | last post by:
Please help me correct the statements in sub "BoundData" The following sub is in a module. Everything runs with no error messages, however,data is not reaching the text box. Data is being appended to WorkingTable but not filtered by value in text box. If I input data into the text box, it gets deleted by the sub routine, indicating that ctla.ItemData(varItm) is null. Sub BoundData() Dim frm As Form
0
1436
Walt in Decatur
by: Walt in Decatur | last post by:
I have a form which is tied to a table with data for equipment belonging in a particular space (tbl_equpment_data). This form is actually a subform on a main form which also deals with other data for the list of spaces. Structure: Main Form: _frm_big_space_list_tab Container Subform: subfrm_main_pane Form that displays general data: subfrm_General_tab Form that displays just the basic equipment data is: ...
0
8753
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9409
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9188
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8110
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6704
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6012
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4787
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2159
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.