CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: Date Entered: 5/9/2006 5:08:21 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 71 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
"Tailwag" <>
NewsGroup User
A simple question about "Advanced SQL Generation Options" in VS20055/9/2006 5:08:21 AM

0

Hello Everyone,

I have been trying for some time to enable Advanced SQL Generation Options in Visual Studio 2005, which covers additional Insert, Update and Delete statements. Mine seems to always be greyed out, meaning I can't access it.

I am on a shared hosted server, and can do everything else with a database, like create it, add data, view it and so on, but I just can't do the advanced options, my question is, "Are these options enabled by default or do I have to go and enable them somewhere in the options (which I could not find)?

Is this a common problem, or a bug in VS2005 or is this particular to me and my local copy of VS2005 on my computer, or is this a problem with the server?

I just created a new database with one table, 1 column, 2 rows, with just a number in each cell, then created a test page, draged a GridView onto it, set the connection string and selected the datasource and when it came to the Advanced Options, it was grayed out, this has always been like this for me, even with past databases.

Is this just me, can anyone make sime suggestions? I just need to know where the problem lies, either my software program (VS2005), my hosted server, or somewhere else I am unaware of. Btw, I have paging, sorting and selection, but can never get the all important Insert, Update & Delete.

Thank you very much for any help.


<Woof>Tailwag</Woof>
"Tailwag" <>
NewsGroup User
Re: A simple question about &quot;Advanced SQL Generation Options&quot; in VS20055/9/2006 8:05:35 AM

0

Hi again,

Just answering my own question. This problem happens when you don't have a primary key in your database table.

So, now I can get the advanced features but they don't seem to work for me. Let me explain:

I have a small test table of names and numbers, nothing fancy, and I made the Names column the primary key. I have created a GridView and when I go to the actual web page and make a change and update it, nothing changes. It all appears to go according to plan, except nothing really changes.

Here is my code, if anyone can see the obvious flaw I would be greatful.

<%

@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" Title="Untitled Page" %>

<

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="Name" DataSourceID="SqlDataSource1">

<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />

<Columns>

<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" SortExpression="Name" />

<asp:BoundField DataField="Number" HeaderText="Number" SortExpression="Number" />

</Columns>

<RowStyle BackColor="White" ForeColor="#003399" />

<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />

<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />

<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />

</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CL567_MEMBERSConnectionString %>"

DeleteCommand="DELETE FROM [Table1] WHERE [Name] = @original_Name AND [Number] = @original_Number" InsertCommand="INSERT INTO [Table1] ([Name], [Number]) VALUES (@Name, @Number)"

SelectCommand="SELECT * FROM [Table1]" UpdateCommand="UPDATE [Table1] SET [Number] = @Number WHERE [Name] = @original_Name AND [Number] = @original_Number" ConflictDetection="OverwriteChanges" OldValuesParameterFormatString="original_{0}">

<DeleteParameters>

<asp:Parameter Name="original_Name" Type="String" />

<asp:Parameter Name="original_Number" Type="Int16" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="Number" Type="Int16" />

<asp:Parameter Name="original_Name" Type="String" />

<asp:Parameter Name="original_Number" Type="Int16" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="Name" Type="String" />

<asp:Parameter Name="Number" Type="Int16" />

</InsertParameters>

</asp:SqlDataSource>

</

asp:Content>

and here is my code behind page, test.aspx.cs:

using

System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partial class Test : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

}

Thanks in advance.

 


<Woof>Tailwag</Woof>
2 Items, 1 Pages 1 |< << Go >> >|




   
  Privacy | Contact Us
All Times Are GMT