I am converting a website that uses an Access Database to SQL Server.
On one particular SqlDataSource I am having a lot of trouble. Here is
the original:
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:MyConnection String%>"
ProviderName="< %$
ConnectionStrin gs:MyConnection String.Provider Name %>"
SelectCommand=" SELECT [Organization], [DocUnid] FROM
[ContactInfo]" DeleteCommand=" DELETE FROM ContactInfo WHERE DocUNID
= ?"></asp:SqlDataSour ce>
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:MyConnection String%>"
ProviderName="< %$
ConnectionStrin gs:MyConnection String.Provider Name %>"
SelectCommand=" SELECT [Organization], [DocUnid], [Notice],
[Wire] FROM [ContactInfo] WHERE ([DocUnid] = ?)" UpdateCommand=" UPDATE
ContactInfo SET Organization = ?, Notice = ?, Wire = ? WHERE DocUnid
= ?">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Grid View1" Name="DocUnid"
PropertyName="S electedValue"
Type="String" />
</SelectParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="Organizat ion" />
<asp:Paramete r Name="Notice" />
<asp:Paramete r Name="Wire" />
<asp:Paramete r Name="DocUnid" />
</UpdateParameter s>
</asp:SqlDataSour ce>
To convert it I have just been changing the ?s to @wire,
@organization, @DocUnid, etc. However, this doesn't seem to be
working. When I call the delete command, it gives me "Must declare
the scalar variable '@DocUnid.'" When I declare DocUnid as a
parameter, it doesn't successfully delete.
Why would this procedure work perfectly under Access, but suddenly
breaks when using sql client? Please let me know if I am doing
something wrong in converting.
On one particular SqlDataSource I am having a lot of trouble. Here is
the original:
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:MyConnection String%>"
ProviderName="< %$
ConnectionStrin gs:MyConnection String.Provider Name %>"
SelectCommand=" SELECT [Organization], [DocUnid] FROM
[ContactInfo]" DeleteCommand=" DELETE FROM ContactInfo WHERE DocUNID
= ?"></asp:SqlDataSour ce>
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:MyConnection String%>"
ProviderName="< %$
ConnectionStrin gs:MyConnection String.Provider Name %>"
SelectCommand=" SELECT [Organization], [DocUnid], [Notice],
[Wire] FROM [ContactInfo] WHERE ([DocUnid] = ?)" UpdateCommand=" UPDATE
ContactInfo SET Organization = ?, Notice = ?, Wire = ? WHERE DocUnid
= ?">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Grid View1" Name="DocUnid"
PropertyName="S electedValue"
Type="String" />
</SelectParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="Organizat ion" />
<asp:Paramete r Name="Notice" />
<asp:Paramete r Name="Wire" />
<asp:Paramete r Name="DocUnid" />
</UpdateParameter s>
</asp:SqlDataSour ce>
To convert it I have just been changing the ?s to @wire,
@organization, @DocUnid, etc. However, this doesn't seem to be
working. When I call the delete command, it gives me "Must declare
the scalar variable '@DocUnid.'" When I declare DocUnid as a
parameter, it doesn't successfully delete.
Why would this procedure work perfectly under Access, but suddenly
breaks when using sql client? Please let me know if I am doing
something wrong in converting.