SqlDataSource -> Access to SQLClient

D

danielhamd

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:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnectionString%>"
ProviderName="<%$
ConnectionStrings:MyConnectionString.ProviderName %>"
SelectCommand="SELECT [Organization], [DocUnid] FROM
[ContactInfo]" DeleteCommand="DELETE FROM ContactInfo WHERE DocUNID
= ?"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnectionString%>"
ProviderName="<%$
ConnectionStrings:MyConnectionString.ProviderName %>"
SelectCommand="SELECT [Organization], [DocUnid], [Notice],
[Wire] FROM [ContactInfo] WHERE ([DocUnid] = ?)" UpdateCommand="UPDATE
ContactInfo SET Organization = ?, Notice = ?, Wire = ? WHERE DocUnid
= ?">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="DocUnid"
PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:parameter Name="Organization" />
<asp:parameter Name="Notice" />
<asp:parameter Name="Wire" />
<asp:parameter Name="DocUnid" />
</UpdateParameters>
</asp:SqlDataSource>

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top