Monday, March 19, 2012

can I add a row to a data base table with VWD Express

I have a data table I have adabted for my own use and want to add a row to the table. Can I do that with Visual Web developer Express?

I can add update modify the colums and data in the exciting table but I cannot figure out how to add a row.

This is just a simple datalist of names. firstname lastname. there are 18 of them and i want to add more names

jayirvin wrote:

I have a data table I have adabted for my own use and want to add a row to the table. Can I do that with Visual Web developer Express?

I can add update modify the colums and data in the exciting table but I cannot figure out how to add a row.

This is just a simple datalist of names. firstname lastname. there are 18 of them and i want to add more names

I am using ASP.NET 2.0 GridView to show the data. I have found some code to incert a row into an ASP DetailsView that even has an auto generate incert button. the code below may work for my gridview if I can create my own incert button: Can anyone help me add a relative to my list of relatives?

Can anyone help me adapt this code

'

<asp:SqlDataSourceID="SqlDataSource"runat="server"ConnectionString="<%$ ConnectionStrings:MyConnectionString1 %>"

DeleteCommand="DELETE FROM [relatives] WHERE

[RelativesID] = @.original_RelativesID"FilterExpression="RelativesID='{0}'"

InsertCommand="INSERT INTO [Relatives] ([RelativesID], [FirstName],

[LastName]) VALUES (@.RelativesID, @.FirstName,

@.LastName)"SelectCommand="SELECT * FROM [Relatives]">

<FilterParameters>

<asp:ControlParameterControlID="GridView1"Name="RelativesID"PropertyName="SelectedValue"/>

</FilterParameters>

<InsertParameters>

<asp:ParameterName="RelativesID"Type="String"/>

<asp:ParameterName="FirstName"Type="String"/>

<asp:ParameterName="LastName"Type="String"/>

</InsertParameters>

</asp:SqlDataSource>

|||

I have solved my own probelm I can incert a row with ASP:FormView

ASP:GridView does not support incert

|||

jayirvin wrote:

ASP:GridView does not support incert

Hi Jay,

The GridView does support database inserts. Did you have an InsertItemTemplate setup?

Marcie

|||

datagridgirl wrote:

jayirvin wrote:

ASP:GridView does not support incert

Hi Jay,

The GridView does support database inserts. Did you have an InsertItemTemplate setup?

Marcie

I was working with edit delete update and select template. WVD only wrote the SQL statements for the select. No incert new

|||

Hi Marcie,

Can you please tell me where I can find more information on inserting a record using GridView?

I have edit and delete functioning fine.

Thanks,

Doug

|||

Hi Doug,

This article has some good info on inserting with a GridView: http://fredrik.nsquared2.com/viewpost.aspx?PostID=155

Also visit the GridView articles section of my site: http://www.gridviewgirl.com/GridViewGirl/articles.aspx

Marcie

|||I had to use and ASP Details view component and add insert delete and new while configuring its data scorce go to advanced

No comments:

Post a Comment