473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.InsertCommandType = SqlDataSourceCommandType.Text
SqlDataSource1.Insert()
Jan 11 '06 #1
3 2470
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******@libertyassociates.com> wrote in message
news:fo******************************@speakeasy.ne t...
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.InsertCommandType = SqlDataSourceCommandType.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\SQLSERVER2005;Initial Catalog=XXX;Integrated
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*************@TK2MSFTNGP15.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******@libertyassociates.com> wrote in message
news:Of********************@speakeasy.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\SQLSERVER2005;Initial Catalog=XXX;Integrated
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*************@TK2MSFTNGP15.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
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...
0
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...
1
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...
0
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"...
3
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"...
2
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...
2
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...
1
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.