473,785 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Option to update, delete not available when creating SqlDataSource

I created a new database (tried both in 2005 and in SQL 2000) and then
created a SqlDataSource control in an asp.net application. Clicked on the
smart tag and whose configure data source. When I click Advanced should see
the Generate Insert, Update and Delete statements check box but it is grayed
out. Any idea what might cause this?

I can work around with this code, which does work:

SqlDataSource1. InsertCommand = "Insert into myTable Values (...)"
SqlDataSource1. InsertCommandTy pe = SqlDataSourceCo mmandType.Text
SqlDataSource1. Insert()
Jan 11 '06 #1
3 2494
Jesse,

You have to set the select command to be able to autogenerate the update and
delete commands. Also the select command may not be a stored procedure. One
way to do this if you want to use stored procedures would be to use the
wizard to create a select command also autogenerating the insert and delete
commands and then copy each of them to a stored procedure afterwards
switching the commands to use said stored procs.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Jesse Liberty" <jl******@liber tyassociates.co m> wrote in message
news:fo******** *************** *******@speakea sy.net...
I created a new database (tried both in 2005 and in SQL 2000) and then
created a SqlDataSource control in an asp.net application. Clicked on the
smart tag and whose configure data source. When I click Advanced should see
the Generate Insert, Update and Delete statements check box but it is
grayed out. Any idea what might cause this?

I can work around with this code, which does work:

SqlDataSource1. InsertCommand = "Insert into myTable Values (...)"
SqlDataSource1. InsertCommandTy pe = SqlDataSourceCo mmandType.Text
SqlDataSource1. Insert()

Jan 11 '06 #2
Thanks. Here's what I did:

1. Deleted existing data source
2. Created new data source
3. Clicked "configure data source
4. Created new connection (used Windows Authentication and tested
connection)
Data Source=BACH\SQL SERVER2005;Init ial Catalog=XXX;Int egrated
Security=True
5. Saved connection string
6. On Configure the select, choose Specify columns from a table or view
7. Set the name to the (one) table in the db
8. Click on *
9. Click on Advanced

Both options are grayed out.

Thanks.

-Jesse

PS: I'm sure I'm doing something stupid, but I've tried this using SQL 2005
and SQL 2000 with and without an identity column in the table. There are no
other tables, nor triggers, constraints etc. that I've added.

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in
message news:eH******** *****@TK2MSFTNG P15.phx.gbl...
You have to set the select command to be able to autogenerate the update
and delete commands. Also the select command may not be a stored
procedure.

Jan 12 '06 #3
Jesse,

Save the datasource only having created the select statement. Then re-open
it and click advanced.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Jesse Liberty" <jl******@liber tyassociates.co m> wrote in message
news:Of******** ************@sp eakeasy.net...
Thanks. Here's what I did:

1. Deleted existing data source
2. Created new data source
3. Clicked "configure data source
4. Created new connection (used Windows Authentication and tested
connection)
Data Source=BACH\SQL SERVER2005;Init ial Catalog=XXX;Int egrated
Security=True
5. Saved connection string
6. On Configure the select, choose Specify columns from a table or view
7. Set the name to the (one) table in the db
8. Click on *
9. Click on Advanced

Both options are grayed out.

Thanks.

-Jesse

PS: I'm sure I'm doing something stupid, but I've tried this using SQL
2005 and SQL 2000 with and without an identity column in the table. There
are no other tables, nor triggers, constraints etc. that I've added.

"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote
in message news:eH******** *****@TK2MSFTNG P15.phx.gbl...
You have to set the select command to be able to autogenerate the update
and delete commands. Also the select command may not be a stored
procedure.


Jan 12 '06 #4

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

Similar topics

6
2396
by: Dabbler | last post by:
I have a GridView with a couple of TemplateFields. When I click the update link the Gridview returns to display mode with no errors but the data from bound text fields or dropdown list isn't updated in the table. I'm stumped and any help would be appreciated. Thanks much. My GridView: <asp:GridView ID="VanListGridView" runat="server"
0
2390
by: Mike P | last post by:
Where exactly are the updateparameters of a gridview picked up from? I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates. Yet this method has worked for 1 gridview and failed for the second gridview. Here is my gridview : <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XConnectionString %>" SelectCommand="ViewForecast"...
1
1826
by: BabuMan | last post by:
Hi, I have a FormView control on a page which is bound to a SQLDataSource table. Everything works fine except for the "Update". I get an InvalidCastException. The problem only seems to surface when I have a 'datetime' column in the table. I tested this with a very simple sample table. As long as there is no datetime column either in the table or on the form, all are peachy. Here is the code, in case somebody can figure it out. I...
0
1613
by: Luigi | last post by:
Hi all, I have the GridView with this code: <asp:GridView OnDataBound="VisualizzaExcel" EnableViewState="False" ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="COD_SALDO" DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None" Width="470px"> <Columns> <asp:BoundField DataField="COD_SALDO"
3
3642
by: J055 | last post by:
Hi I have a PlaceHolder control inside a FormView EditItemTemplate: <asp:PlaceHolder ID="phResponseText" runat="server"> <tr> <td> <asp:Label ID="lblResponseText" runat="server"></asp:Label></td> <td> <asp:TextBox ID="tbResponseText" runat="server" Text='<%#
2
2483
by: Danielle | last post by:
Hello all - Thank you in advance for any help you are able to provide. I am populating a gridview from a stored procuedure. The returned data is a name, phone number, email and guid of a contact in our database. I also need to use the Edit and Delete funtions in the gridview. Neither seems to be working as intended.
2
2638
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
1
3737
by: spamguy | last post by:
I am working porting ugly .NET 1.1 DataGrids to 2.0 GridViews. The GridView fills correctly via SqlDataSource. When I click Edit -> -> Update, the page refreshes but the update command clearly never fired. (Putting stuff in the GridView's OnRowUpdating function proves this.) The row also remains in edit mode. The code: <asp:SqlDataSource ID="dsMyReports" runat="server" ConnectionString="<%$...
4
2907
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field is not a null value. I am not using any code behind (C#) to bind the data or manipulate the data. I have read that when there is a null value in the database that there is no record in the "dataset". Can anyone show me how to bind a value in the...
0
9485
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
10356
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...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9958
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
7506
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
6743
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();...
1
4058
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
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2890
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.