473,748 Members | 8,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlDataSource -> Access to SQLClient

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.

Apr 25 '07 #1
0 1167

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

Similar topics

8
5039
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my select, remember it, and then use it in the update. It works just fine when I have full control of the whole process. I want to do the same for my GridView/SqlDataSource combinations. I typically select from a view and update the corresponding...
3
5070
by: zapov | last post by:
Hi! Did anyone successfully managed to use some custom ADO.NET provider with SqlDataSource? I'd like to connect to some other database than MSSQL (like MySQL, Firebird or PostgreSQL) but I'm having problems making this work. Inside connectionStrings I added my name, provider and connectionString but for some reason SqlDataSource is trying to use System.Data.SqlClient even if my provider is different.
3
2234
by: adam222 | last post by:
hello, i have a web-form with a GridView control, i wanted to update & delete, using the AutoGenerateEditButton. when i used it with sqlDataSource (executing SP in the DB) it works like a charm, but when i want to pass the data through the application's layers (BL etc.), it did not work. it seems that the 'AutoGenerateEditButton' is capable only with sqlDataSource...
3
6410
by: Jim Andersen | last post by:
Just to let you know, and to help any future sorry sods who gets trapped in the same black hole...... You can't just copy/move a working sql-statement into a stored procedure. Working with a sqldatasource. Conflictdetection set to compareallvalues. Oldvaluesparameterformatstring set to original_{0} tblA has 2 fields. ID and MyText. Deletecommand="Delete from tblA where ID=@original_ID"
3
4534
by: simonZ | last post by:
In gridView I have dropdown list : <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
0
3383
by: cyberbless | last post by:
I would like to dynamically assign a Select Statment to a a SqlDataSource. Problem is the SqlDataSource.Select() Command requires a "dataSourceSelectArgument" as one of its arguments. 1. What if I don't have an argument to give to out our the Select Statement. Or if the arguments are pre-assigned. Take the following lines of code for example. --------------------------------------------------------- SqlDataSource.InsertCommand =...
5
7688
by: msch-prv | last post by:
Hi, I am trying to tie a SQLDataSource control to MySQL without success. The connection string works ok with an ObjectDataSource. (Native asp.net 2.0 MySQL dll loaded in /bin) For some reason, the compiler believes an SQL db is being accessed ("An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does...
2
1998
by: djc | last post by:
1) I am wondering if I should be using an sqlDataSource object for my particular scenario. I need to loop through a listbox and perform an INSERT sql operation for each item. Could be a few or several items. The reason I'm wondering if I should use an SqlDataSource object is overhead. For example, prior to learning about the sqlDataSource I would just code the ado.net procedure myself. For example, create connection object, create and...
2
2088
by: Julien Sobrier | last post by:
Hello, I have 2 SqlDataSource on the same page that retrieve the same column names: <asp:SqlDataSource ID="SqlStructure" runat="server" SelectCommand="SELECT a, b FROM c WHERE d = 0 /> <asp:SqlDataSource ID="SqlSons" runat="server" SelectCommand="SELECT a, b FROM c WHERE d = 74" /> The problem is that Eval("a") always return the value from SqlStructure.
0
1257
by: staeri | last post by:
I have a dropdownlist attached to a SqlDataSource inside an Accordion. I receive the following error message when the SqlDataSource is inside the Accordion: "The DataSourceID of 'ddGroup' must be the ID of a control of type IDataSource. A control with ID 'SqlDataSourceGroup' could not be found." I've been suggested to move the SqlDataSource out of the Accordion to get rid of the error message above, but when I do so the SqlDataSource
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
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,...
1
9312
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
9238
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...
1
6793
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
6073
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
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.