GridView && SqlDataSource Delete Problem

May 2, 2008

 Hi guys! I have a simple windows form where a gridview is being populated by a database. I have checked the ability to update, insert delete. And everything is fine but when i want to delete a row it throws an exeption. The exeptions says:
 "
Must declare the scalar variable "@id".
"
I haven't changed the delete, update and insert commands. They are as fallows
DeleteCommand="DELETE FROM [recepti] WHERE [id] = @id"
InsertCommand="INSERT INTO [recepti] ([ime], [recepta], [snimka], [snimka2], [tip]) VALUES (@ime, @recepta, @snimka, @snimka2, @tip)" 
SelectCommand="SELECT * FROM [recepti]"
UpdateCommand="UPDATE [recepti] SET [ime] = @ime, [recepta] = @recepta, [snimka] = @snimka, [snimka2] = @snimka2, [tip] = @tip WHERE [id] = @id" 
The id column is auto generated, unique, also it's a primery key.

So any idea where is the problem?
 

View 2 Replies


ADVERTISEMENT

Gridview And Sqldatasource

May 3, 2008

 
i have a gridview which is bound to sqldatasource. i have a delete button in the gridview. I have written code for "deleting" a record in app_code directory.
now iam not using "deletecommand" of sqldatasource but on the click of "delete" link i want to call the procedure in the app_code.
Any ideas on how to do it.??
 

View 4 Replies View Related

GridView - SqlDataSource

Apr 14, 2006

I have created a GridView that uses a SqlDataSource.  When I run the page it does not pull back any data.  However when I test the query in the SqlDataSource dialog box it pulls back data.
Here is my GridView and SqlDataSource:
<asp:GridView ID="Results" runat="server" AllowPaging="True" AllowSorting="True"
CellPadding="2" EmptyDataText="No records found." AutoGenerateColumns="False" Width="100%" CssClass="tableResults" PageSize="20" DataSourceID="SqlResults" >
<Columns>
<asp:BoundField DataField="DaCode" HeaderText="Sub-Station" SortExpression="DaCode" >
<ItemStyle HorizontalAlign="Center" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Center" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="DpInfo" HeaderText="Delivery Point" SortExpression="DpInfo" >
<HeaderStyle HorizontalAlign="Left" CssClass="tdHeaderResults" />
<ItemStyle CssClass="tdResults" />
</asp:BoundField>
<asp:HyperLinkField DataNavigateUrlFields="CuCode,OrderID" DataNavigateUrlFormatString="TCCustDetail.asp?CuCode={0}&amp;OrderID={1}"
DataTextField="OrderID" HeaderText="Order No" SortExpression="OrderID">
<ItemStyle CssClass="tdResults" HorizontalAlign="Center" />
<HeaderStyle CssClass="tdHeaderResults" HorizontalAlign="Center" />
</asp:HyperLinkField>
<asp:BoundField HeaderText="Order Date" SortExpression="OrderDate" DataField="OrderDate" >
<ItemStyle HorizontalAlign="Center" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Center" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="ReqDeliveryDate" HeaderText="Req Delivery Date" SortExpression="ReqDeliveryDate" >
<ItemStyle HorizontalAlign="Center" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Center" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="StatusDate" HeaderText="Status Date" SortExpression="StatusDate">
<ItemStyle HorizontalAlign="Center" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Center" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="ManifestNo" HeaderText="Manifest No" SortExpression="ManifestNo">
<ItemStyle HorizontalAlign="Center" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Center" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="CustomerPO" HeaderText="P.O. No" SortExpression="CustomerPO">
<ItemStyle HorizontalAlign="Center" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Center" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class">
<ItemStyle HorizontalAlign="Left" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Left" CssClass="tdHeaderResults" />
</asp:BoundField>
<asp:BoundField DataField="OrderStatus" HeaderText="Order Status" SortExpression="StatusSort">
<ItemStyle HorizontalAlign="Left" CssClass="tdResults" />
<HeaderStyle HorizontalAlign="Left" CssClass="tdHeaderResults" />
</asp:BoundField>
</Columns>
<HeaderStyle ForeColor="White" HorizontalAlign="Left" />
<AlternatingRowStyle CssClass="tdResultsAltRowColor" />
</asp:GridView>
<asp:SqlDataSource ID="SqlResults" runat="server" ConnectionString="<%$ ConnectionStrings:TransportationConnectionString %>" SelectCommand="GetOrderSummaryResults" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter DefaultValue="10681" Name="CuCode" Type="String" />
<asp:Parameter DefaultValue="" Name="DaCode" Type="String" />
<asp:Parameter DefaultValue="" Name="DpCode" Type="String" />
<asp:Parameter DefaultValue="" Name="OrderID" Type="String" />
<asp:Parameter DefaultValue="" Name="ManifestNo" Type="String" />
<asp:Parameter DefaultValue="" Name="PONo" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
I can get it to fill with data by manually filling the GridView without using a SqlDataSource but then I cannot get the sorting to work when I do it that way.  Actually not sure if the sorting will work this way either as I cannot get it to fill with data.  Any ideas would be much appreciated.

View 1 Replies View Related

&<asp:SqlDataSource&> Generate SQL For GridView?

Oct 31, 2006

Hi guys.Im using a gridview to show some training data on my website which is populated by:<asp:SqlDataSource ID="ARENATraining" runat="server" ConnectionString="<%$ ConnectionStrings:ARConnection %>"    SelectCommand="SELECT [EventType], [CourseLink], [EventDate], [EventTitle], [EventLocation], [EventWebsite] FROM [qry_FutureEvents] WHERE ([EventPrivate] = @EventPrivate) ORDER BY [EventDate]">    <SelectParameters>      <asp:Parameter DefaultValue="FALSE" Name="EventPrivate" Type="Boolean" />    </SelectParameters> So far so good..However I want to be able to filter the data.A) Show everythingB) Show individual EventType i.e. Seminar, Training etc etcIs it possible to generate the Select Command via a function? (im not using stored procedures for this part of the site, nor really want to at the moment).  Id appreciate any help, otherwise ill be forced to curse and swear and use the good ol repeater and figureing out how to page it! Cheers guys  

View 6 Replies View Related

Question About Gridview And SqlDataSource

Jan 28, 2007

i am now writing a web page which can allow users to edit the field(display in the gridview->gridview  source is from sqldatasource), there is a problem(it seems that i have followed all steps in the book):
when the i edit the field and click update, in the web site, i can see those changes. however, i cant see any change in database table.
i cant find  solution on this, could anyone help me to solve this problem? thx!

View 2 Replies View Related

Profile, SQLDataSource And GridView

May 11, 2007

Hello.When I create a user at the ASP.NET database, I need to insert more fields than the defaults, and I do it like this:         Dim customProfile As ProfileCommon = ProfileCommon.Create(CreateUserWizard1.UserName, True)              
customProfile.telephone =
(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("TelephoneText"),
TextBox)).Text(telephone example)Those data are inserted at the DB at the aspnet_Profile table, in the fields PropertyNames & PropertyValuesString, but they are saved together (see image above)

I want to separate those properties in the GridView as long as each property appears in a column, is it possible? Thank you very much, i'm expecting your answers.

View 11 Replies View Related

SqlDataSource, GridView && A Button

Jan 12, 2008

hi .. i have a SqlDataSource, GridView & a Button ..  i want to increase the condition in the "SelectCommand" below by one everytime i click the button .. i mean to be like that ID < 8 instead of ID < 7
so, the GridView will show 7 ID's instead of 6 .. and it will increase everytime i hit the button<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:connectionstring %>"
SelectCommand="SELECT * FROM [table1] WHERE ID < 7">
</asp:SqlDataSource>
 

View 4 Replies View Related

Number Of Records In SQLDataSource/GridView

Aug 21, 2006

What is the easiest way to obtain number of records in SQLDataSource (using select statement)/GridView. All that I've found in forums seems to be very difficult for such trivial task... Thank you!

View 4 Replies View Related

Gridview Updated + SQLDatasource + UserName

Apr 15, 2008

Hi
I have a gridview which is using a SQLdatasource, to update the table.  One of my parameters on the SP is username.
At the moment on page load I am declaring a session variable
Session("UserName") = me.user.identy.name
I then amend the update parameter in the SQL Datasource to accept the username from the session variable.  - works fine,  I was however wondering if there is a way of returning the username directly into the sqldatasource without having to pass it through a session variable?
 
regards
 
Tom

View 3 Replies View Related

An SQLDataSource On 2 Other DataSources? Show In A GridView

May 19, 2008

Hi,I have two SQLDataSources called "LeagueTableHome" an "LeagueTableAway" on my page.
I want to create another SQLDataSource called "LeagueTableTotal" on my page which adds up all the totals from each of the other two sources.
The datasource looks like this:
Team, Pld, W, D, L, F, A, Agg, Pts
my code for LeagueTableHome looks like this:
SELECT HomeTeam, 1 AS Pld, CASE WHEN HomeScore > AwayScore THEN 1 ELSE 0 END AS Won, CASE WHEN HomeScore = AwayScore THEN 1 ELSE 0 END AS Draw, CASE WHEN HomeScore < AwayScore THEN 1 ELSE 0 END AS Lost, HomeScore AS Scored, AwayScore AS Against, HomeScore - AwayScore AS Agg, CASE WHEN HomeScore > AwayScore THEN 3 ELSE 0 END AS Pts FROM tblFixtures WHERE (CompID = 1) AND (HomeScore IS NOT NULL)
I want then to show LeagueTableTotal in a GridView.
Can anybody help?
 

View 4 Replies View Related

Changing The SQLDatasource SELECT For A Gridview

May 19, 2008

I cant seen to change the Select command for a SQL Datasourcetry #1            SqlDataSourceProfilesThatMatch.SelectCommand = strSQLForSearch            SqlDataSourceProfilesThatMatch.SelectParameters("ProfileID").DefaultValue = pProfileID            SqlDataSourceProfilesThatMatch.SelectParameters("LoggedInUsersZipcode").DefaultValue = pUsersZipCode            SqlDataSourceProfilesThatMatch.SelectParameters("ZipDistance").DefaultValue = pDistance
            NewProfilesThatMatchGridView.DataBind()
try #2            SqlDataSourceProfilesToBeMatched.SelectParameters.Clear()            SqlDataSourceProfilesThatMatch.SelectCommand = strSQLForSearch            SqlDataSourceProfilesThatMatch.SelectParameters.Add("ProfileID", pProfileID)            SqlDataSourceProfilesThatMatch.SelectParameters.Add("LoggedInUsersZipcode", pUsersZipCode)            SqlDataSourceProfilesThatMatch.SelectParameters.Add("ZipDistance", pDistance)
            NewProfilesThatMatchGridView.DataBind()
No errors but no rows show in the gridview. If I debug and get the value strSQLForSearch and paste it into a new SQL query window I get results.
Any ideas????
Thanks
 

View 3 Replies View Related

Binding A SqlDataSource, To A GridView At Runtime

Mar 8, 2006

Hello
I'm experiencing some problems, binding a SqlDataSource to a GridView.
The following code creates the SqlDataSource:            string strConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;            string strProvider = ConfigurationManager.ConnectionStrings["ConnectionString"].ProviderName;                        SqlDataSource ds = new SqlDataSource(strProvider, strConn);            ds.SelectCommand = "SELECT * FROM rammekategori";
Then i bind the SqlDataSource to a GridView:
         GridView1.DataSource = ds;            GridView1.DataBind();
 
ErrorMessage:
Format of the initialization string does not conform to specification starting at index 0.
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.Line 24:             GridView1.DataBind();Am i totally off target here? Can it be something about, that you have to set the datasource of the gridview, before the Page_Load event?
 
Thanks - MartinHN

View 9 Replies View Related

GridView Via SQLDataSource And Stored Procedure

Apr 17, 2006

Help!I am trying to fill my datagrid using the SQLDataSource, using a stored procedure.The stored procedure expects a parameter which I can collect via the querystring, or a string.  How can I pass the parameter through the SQLDatasSource?My SQLDataSource is SQLData1.  I already have:SQLData1.SelectCommandType = SqlDataSourceCommandType.StoredProcedureSQLData1.SelectCommand = "dbo.get_players"Thanks in advance,Karls

View 2 Replies View Related

SqlDataSource Not Updating On Editing GridView

Mar 4, 2007

Hi, I'm new in ASP 2.0. I need to incorporate edit and delete capability in GridView. Using the wizard, i've generated this code. When I delete a row, it gets deleted but update does not work. I've tried several ways. I got no error or exception. But row is not updated. I've checked database, and I think the update query is not executing at all. Please let me know, what I'm doing wrong? Here is the source code for reference. I'm using Visual Studio 2005 with SQL server 2005 Express Edition. Regards

==========================================================
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="QuoteItemID" DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" CausesValidation="False" /> <asp:BoundField DataField="QuoteItemID" HeaderText="QuoteItemID" InsertVisible="False" ReadOnly="True" SortExpression="QuoteItemID" /> <asp:BoundField DataField="QuoteID" HeaderText="QuoteID" SortExpression="QuoteID" /> <asp:BoundField DataField="ChargeCodeID" HeaderText="ChargeCodeID" SortExpression="ChargeCodeID" /> <asp:BoundField DataField="RateItemAmount" HeaderText="RateItemAmount" SortExpression="RateItemAmount" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ratesdb %>" DeleteCommand="DELETE FROM [Quote_item] WHERE [QuoteItemID] = @QuoteItemID" InsertCommand="INSERT INTO [Quote_item] ([QuoteID], [ChargeCodeID], [RateItemAmount]) VALUES (@QuoteID, @ChargeCodeID, @RateItemAmount)" SelectCommand="SELECT * FROM [Quote_item]" UpdateCommand="UPDATE [Quote_item] SET [QuoteID] = @QuoteID, [ChargeCodeID] = @ChargeCodeID, [RateItemAmount] = @RateItemAmount WHERE [QuoteItemID] = @QuoteItemID" ConflictDetection="CompareAllValues"> <DeleteParameters> <asp:Parameter Name="QuoteItemID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="QuoteID" Type="Int32" /> <asp:Parameter Name="ChargeCodeID" Type="Int32" /> <asp:Parameter Name="RateItemAmount" Type="Decimal" /> <asp:Parameter Name="QuoteItemID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="QuoteID" Type="Int32" /> <asp:Parameter Name="ChargeCodeID" Type="Int32" /> <asp:Parameter Name="RateItemAmount" Type="Decimal" /> </InsertParameters> </asp:SqlDataSource>

View 6 Replies View Related

Removing Rows From A SqlDataSource Before It Is Bound To A GridView?

Nov 5, 2006

I have a SqlDataSource that I need to remove the first 3 rows from before it is bound to a GridView. How would I go about doing this?
(if I could remove them at the db level in the sproc I would, but right now that is not an option - so I need to do it once I've already received the data)
Thanks.

View 9 Replies View Related

Problem Encountered With Filterparameter On SQLDataSource For GridView

Jan 9, 2007

Hi,
I have a GridView connected to a sqldatasource control.  Everything is working great, updates, paging and filtering with one exception.  When the user enters in a name like O'Reilly (with a single quote), the page errors.  The error returned is:
Syntax error: Missing operand after 'Reilly' operator.
 Here is the definition of the sqldatasource:
        <asp:SqlDataSource ID="SqlDataSourcePersons" runat="server"             ConnectionString="<%$ ConnectionStrings:database %>"            SelectCommand="SELECT [Id], [FirstName], [LastName], , [PersonTypeId], [WorkerId], [_workerNTId], [Title], [City] FROM [Person]"            FilterExpression="(FirstName like '{0}%') AND (LastName like '{1}%') AND (WorkerId like '{2}%') AND (City like '{3}%')" ProviderName="System.Data.SqlClient">            <FilterParameters>              <asp:ControlParameter ControlID="TextBoxFirstName" Name="FirstName" DefaultValue="%" PropertyName="Text" Type="String" />              <asp:ControlParameter ControlID="TextBoxLastName" Name="LastName" DefaultValue="%" PropertyName="Text" Type="String" />              <asp:ControlParameter ControlID="TextBoxWorkerId" Name="WorkerId" DefaultValue="%" PropertyName="Text" Type="String" />              <asp:ControlParameter ControlID="TextBoxCity" Name="City" DefaultValue="%" PropertyName="Text" Type="String" />            </FilterParameters>        </asp:SqlDataSource>
Any suggestions would be appreciated.
Thank you, Jim

View 1 Replies View Related

Change Dynamically(via Code) The SqlDataSource For A GridView....

Mar 7, 2007

Hi,
say I have two Sqldatasources objects:SqlDataSource1 and SqlDataSource2....
Does anybody know how can I alter programmatically these two sqldatasources in a gridview?
Thanks!!!

View 3 Replies View Related

SqlDataSource + GridView - Scalar Variables Not Being Read

Mar 11, 2007

Hi all, first post, and I am desperate.
I have a SqlDataSource with a Select, Update and Delete command. From what I understand, scalar variables should be read automatically from the GridView's BoundField columns when it executes a command on it. Here is my code:
 
<asp:GridView
ID="teamGrid"
EmptyDataText="n/a"
DataKeyNames="TeamId"
AutoGenerateColumns="false"
DataSourceID="teamSource"
OnRowEditing="validateEdit"
OnRowDeleting="validateDelete"
runat="server">
 
<Columns>
<asp:CheckBoxField DataField="TeamApproved" HeaderText="Approved" />
<asp:BoundField DataField="TeamName" HeaderText="Team Name" />
<asp:TemplateField HeaderText="City">
<ItemTemplate>
<asp:Label runat="server"><%# Eval("City") %></asp:Label>, <asp:Label runat="server"><%# Eval("ProvinceCode") %></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RequestedDivision" HeaderText="Division Req." ControlStyle-Width="60px" />
<asp:BoundField DataField="DivisionCode" HeaderText="Assigned Division" ControlStyle-Width="60px" ConvertEmptyStringToNull="true" NullDisplayText="n/a" />
<asp:BoundField DataField="DivisionNumber" HeaderText="Division Number" ControlStyle-Width="60px" ConvertEmptyStringToNull="true" NullDisplayText="n/a" />
<asp:BoundField DataField="Password" HeaderText="Password" ConvertEmptyStringToNull="true" NullDisplayText="n/a" />
<asp:CheckBoxField DataField="Paid" HeaderText="Paid" />
<asp:HyperLinkField Text="view players" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Center" DataNavigateUrlFields="TeamId" DataNavigateUrlFormatString="viewTeamPlayers.aspx?teamId={0}" ShowHeader="false" />
<asp:CommandField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30px" ButtonType="Link" EditText="edit" ShowEditButton="true" ShowHeader="false" />
<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30px">
<ItemTemplate>
<asp:LinkButton runat="server" CausesValidation="False" CommandName="Delete" OnClientClick='return confirm("Deleting this team will also delete the players. Are you sure you wish to continue?");' Text="delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource
ID="teamSource"
ConnectionString="<%$ ConnectionStrings:MB %>"
SelectCommand="SELECT TeamId, TeamName, ProvinceCode, City, DivisionCode, DivisionNumber, TeamApproved, RequestedDivision, Paid, Password, CaptainId, Player2Id, Player3Id, Player4Id FROM [Team]"
UpdateCommand="UPDATE [Team] SET TeamName = @TeamName, DivisionCode = @DivisionCode, DivisionNumber = @DivisionNumber, TeamApproved = @TeamApproved, Paid = @Paid, Password = @Password WHERE TeamId = @TeamId"
runat="server" />
</form>
 
I apologize for the way the code is put in, the code thing cut off a lot of the text! The problem I'm getting is, when the 'Update' button is hit, I get the error: Must declare the variable '@TeamId'.
 
I've tried putting "Update Parameters", that takes away the error, but the row does not update. I've browsed the internet and saw the same problems in lots of areas, but either a) none of the solutions work for me, or b) they don't really apply to my case.
 I'm using ASP .NET 2.0, and (obviously) C#. SQL Server database.
 Any help is greatly appreciated. Thanks in advance,
 
- Branden

View 2 Replies View Related

Sqldatasource How To Not Load The Gridview With The SqldataSoruce At Page_load C#

May 11, 2007

hello all
1)   I was using SQLdataSource and bind it with the gridviw to show its data.  so that is how is running
      when the page load,  i see the data is posted on the page on the gridview.
      But what i need to do when I want a user to click a button  and then the Gridview show the data.
 
   As i was creating a SQLDatasource, it was click click and click but  I want to put that sqldatasouce to load the data in gridview by a click event.
 
2) my second question is also related to the first one or just similar.
I dont want to get all the data rather filter it.  
so once the page load,  there is a button and a text box.
In the text box user going to type the EmployeeID and click the "Employee Info" button and then the data would show up. 
Rather i use te DetaildView Control . What should I do to load the information on the Text boxes rather then on the GridView since it is going to be a single recrod.  
Thanks all
 

View 1 Replies View Related

Binding A Gridview To Sqldatasource On Button Click

Mar 3, 2008

 i am using 2 textbox to search name and instituition of some students. on button click  need to display the result on gridview. but i dont get any result.. pl adviceSqlDataSource1.SelectCommand = "SELECT Sname, Address, Instituition, Role, Testgroup, Email FROM std_det WHERE (Sname LIKE '%'+@Param1+'%') AND (Instituition = 'RASET') AND (Role LIKE '%'+@Param2+'%') AND (Instituition = 'RASET')";            name.ControlID = "TextBox3";            name.DefaultValue = "%";            name.Name = "Param1";            name.PropertyName = "Text";            inst.ControlID = "TextBox4";            inst.DefaultValue = "%";            inst.Name = "Param2";            inst.PropertyName = "Text";            //SqlDataSource1.Select(DataSourceSelectArguments.Empty);            SqlDataSource1.SelectParameters.Add(name);            SqlDataSource1.SelectParameters.Add(inst);            SqlDataSource1.DataBind();            //DataView dv = (DataView)this.SqlDataSource1.Select(DataSourceSelectArguments.Empty);            GridView2.DataSourceID = "SqlDataSource1";                        GridView2.DataBind();

View 2 Replies View Related

Qestion About SQLDataSource, Gridview, And Update Panel

Jun 4, 2008

I have a gridview that is tied to a SQLDataSource control which is inside an update panel.
What I'm trying to accomplish is when the page is loaded the gridview is filled from the SQLDataSource. I have some textboxes also on the page so that the user can add new items to the gridview. The update panel trigger is tied to my code behind page through a button click which added the new data to the DB with an INSERT statement. Since the gridview was inside the update panel I thought when I placed the new data into the DB and the update panel caused the portion of the page that holds the gridview to refresh that the gridview would show the newly added data but it is not.
I am missing something but I do not know what. I tried adding a gridview1.databind() and SQLDataSource1.DataBind() but niether caused the update of the gridview as I had hoped.
Thanks for any of your help.
Ty

View 7 Replies View Related

GridView Update, With SqlDataSource UpdateCommand Set From Code-behind. (C#)

Mar 9, 2006

Hi all
I have a GridView on an aspx page, that is enabled for editing, deletion and sorting.
In the Page_Load event of the aspx page, i add a SqlDataSource to the page, and bind the source to the GridView.
When i click the update, or delete button, it makes a PostBack, but nothing is affected. I'm sure this has got something to do with the parameters.
First, i tried having the GridView.AutoGenerateColumns set to True. I have also tried adding the columns manually, but no affect here either.
The code for setting the commands, and adding the SqlDataSource to the page are as follows:
            string strConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;            string strProvider = ConfigurationManager.ConnectionStrings["ConnectionString"].ProviderName;            string selectCommand = "SELECT * FROM rammekategori";                        SqlDataSource ds = new SqlDataSource(strProvider, strConn, selectCommand);            ds.ID = "RammeKategoriDS";            ds.UpdateCommand = "UPDATE rammekategori SET Kategoribeskrivelse = @Kategoribeskrivelse WHERE (Kategorinavn = @Kategorinavn)";            ds.DeleteCommand = "DELETE FROM rammekategori WHERE (Kategorinavn = @Kategorinavn)";                        Parameter Kategorinavn = new Parameter("Kategorinavn", TypeCode.String);            Parameter Kategoribeskrivelse = new Parameter("Kategoribeskrivelse", TypeCode.String);            ds.UpdateParameters.Add(Kategorinavn);            ds.UpdateParameters.Add(Kategoribeskrivelse);            ds.DeleteParameters.Add(Kategorinavn);
            Page.Controls.Add(ds);
            SqlDataSource m_SqlDataSource = Page.FindControl("RammeKategoriDS") as SqlDataSource;
            if (m_SqlDataSource != null)            {                this.gvRammeKategorier.DataSourceID = m_SqlDataSource.ID;            }
As mentioned - no affect at all!
Thanks in advance - MartinHN
 

View 4 Replies View Related

Performance Comparison - Code Vs SqlDataSource, Gridview Etc Vs PlainControl

Jun 9, 2007

There are so many ways to use database in asp.net/ado.net, I'm a bit confused about their difference from the performance point of view.So apparently SqlDataSource in DataReader mode is faster than DataSet mode, at a cost of losing some bolt-on builtin functions.What about SqlDataSource in DataReader mode vs manual binding in code? Say creating a SqlDataSource ds1 and set "DataSourceID" in Gridview, vs manually creating the SqlConnection, SqlCommand, SqlDataReader objects and mannually bind the myReader object to the gridview with the Bind() method.Also Gridview is a very convenient control for many basic tasks. But for more complex scenarios it requires lots of customization and modification. Now if I do not use gridview at all and build the entire thing from scratch with basic web controls such as table and label controls, and mannually read and display everything from a DataReader object, how's the performance would be like compared to the Gridview-databind route?

View 3 Replies View Related

Gridview Button For Calling Sqldatasource.update Fails

Aug 1, 2007

<!-- Trying
to create a GridView Survey form:
    Hi [User]
    Do you have these assets? 
    [Gridview]
    Tag Number   Response
    123         
[Yes ] [No] [Comments textbox]
    234         
[Yes ] [No] [Comments textbox] 

Goal: The desire
is for the user to click Yes or No and have the database updated with the
user's name, date, response and any comments.  





So far, I have
created SqlDataSource with Select and Update commands, created the gridview and
response buttons, setup the RowCommand and On_Updating Functions. 

Problems:1) If I call the update() function for SqlDataSource1 and misuse the Defaultvalue parameters to run the sql, no update is posted to the database.

2) If I use the On_Update function to set the parameter values, I get "Data type mismatch in criteria expression."  (Additionally, the On_Update function runs twice which I don't understand)Can anyone tell
me what/why? (and how to fix it?)Sorry for the deluge, but here is the code:
-->

<%@ Page
Language="VB"
%>
<html>
<head id="Head1" runat="server">
    <title>Asset Survey</title>
</head>
<SCRIPT runat="server">
    Protected Sub SqlDataSource1_Selecting(ByVal
sender As Object,
ByVal e As
System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting
        e.Command.Parameters("Name1").Value = User.Identity.Name
    End Sub







    Protected Sub SqlDataSource1_Updating(ByVal
sender As Object,
ByVal e As
System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Updating        'For some
reason, this function executes twice        '2nd execution gets error: "Data type
mismatch in criteria expression."        'e.Command.Parameters("PrimaryKey1").Value
= intPrimaryKey        'e.Command.Parameters("Responder1").Value
= strUser        'e.Command.Parameters("ResponseDate1").Value
= dtModDate        'e.Command.Parameters("Response1").Value
= strResponse        'e.Command.Parameters("ResponseComments1").Value
= strComments    End Sub

    Protected Sub
GridView1_RowCommand(ByVal sender As Object, ByVal e As
GridViewCommandEventArgs) _
        Handles
GridView1.RowCommand 
        Dim
GridRow1 As Integer
= Convert.ToInt32(e.CommandArgument)
        If
e.CommandName = "UpdateYes" Then
            'code here to disable buttons and textbox
            '...
           
SqlDataSource1.UpdateParameters("Response1").DefaultValue
= "Yes"
        End If    

        If
e.CommandName = "UpdateNo" Then
            'code here to disable buttons and textbox
            '...
           
SqlDataSource1.UpdateParameters("Response1").DefaultValue
= "No"
        End If

   
    'if I use the SqlDataSource1_Updating
function, I get the mismatch error
        'but if I (mis)use the DefaultValue
parameter, no update occurs.
        SqlDataSource1.UpdateParameters("ResponseComments1").DefaultValue = _
           
GridView1.Rows(GridRow1).FindControl("txtComments").ToString
        SqlDataSource1.UpdateParameters("Responder1").DefaultValue =
User.Identity.Name
        SqlDataSource1.UpdateParameters("ResponseDate1").DefaultValue =
DateTime.Now
        SqlDataSource1.UpdateParameters("PrimaryKey1").DefaultValue = _
           
GridView1.Rows(GridRow1).Cells(0).Text
           
   
    Try
          
SqlDataSource1.Update() 'Error Here if I use on_updating: "Data
type mismatch in criteria expression."
        Catch except As Exception
            ' Handle the Exception.
        End Try
    End Sub

</SCRIPT>
<body>
    <form id="formInv"
runat="server">
    <div>
          <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$
ConnectionStrings:LocalTestMDB %>"
            ProviderName="<%$
ConnectionStrings:LocalTestMDB.ProviderName %>"
            SelectCommand="SELECT
[PrimaryKey], [Name], [AssetTag], [Response], [Responder],
[ResponseDate],[ResponseComments] FROM [Tablename] WHERE ([Name] = ?) ORDER BY
[Login Name], [AssetTag]"
            UpdateCommand="Update
[Tablename] SET [Response]=@Response1, [Responder]=@Responder1,
[ResponseDate]=ResponseDate1, [ResponseComments]=ResponseComments1 WHERE
[PrimaryKey]=@PrimaryKey1"
            OnSelecting="SqlDataSource1_Selecting"
            OnUpdating="SqlDataSource1_Updating">
            <SelectParameters>
        
       <asp:Parameter DefaultValue=""  Name="Name1" Type=String />
            </SelectParameters>
            <UpdateParameters>
               
<asp:Parameter Name="ResponseComments1"
Type=String DefaultValue=""
/>
               
<asp:Parameter Name="Response1"
Type=String DefaultValue=""
/>
               
<asp:Parameter Name="ResponseDate1"
Type=DateTime DefaultValue="#8/1/2007
12:00:00PM#" />
               
<asp:Parameter Name="Responder1"
Type=String DefaultValue=""
/>
               
<asp:Parameter Name="PrimaryKey1"
Type=Int32 DefaultValue=0 />
            </UpdateParameters>
        </asp:SqlDataSource>
        <span>Hi, Please
respond by clicking "Yes" or "No" for each asset</span>
        <asp:GridView ID="GridView1" runat="server"
            AutoGenerateColumns="False"
DataKeyNames="PrimaryKey"
            DataSourceID="SqlDataSource1">

           
<Columns>
               
<asp:BoundField DataField="PrimaryKey"
HeaderText="PrimaryKey"
       
            AccessibleHeaderText="PrimaryKey" Visible=False/>           

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

               
<asp:BoundField DataField="AssetTag"
HeaderText="AssetTag"
SortExpression="AssetTag"
               
    AccessibleHeaderText="AssetTag"
/>
               
<asp:TemplateField 
HeaderText="Please
Respond">
                   
<ItemTemplate>
                   
<asp:Button ID="btnYes" runat="server"
Text="Yes"
Visible="true"
               
        CommandName='UpdateYes'
               
        CommandArgument='<%#
CType(Container, GridViewRow).RowIndex %>' />
                   
<asp:Button ID="btnNo" runat="server"
Text="No"
Visible="true"
               
        CommandName='UpdateNo'
               
        CommandArgument='<%#
CType(Container, GridViewRow).RowIndex %>' />&nbsp;
                   
<br />
                   
<asp:Label ID="lblComments"
runat="server"
Text="Comments:"
Visible=True></asp:Label>
                   
<asp:TextBox ID="txtComments"
runat="server"
Text='<%#
Bind("ResponseComments") %>'
       
               
Visible=True MaxLength=512 Height=24 Width=320 Wrap=True Enabled=True
               
        TextMode=MultiLine></asp:TextBox>&nbsp;
                   
</ItemTemplate>
               
</asp:TemplateField>
            </Columns>
        </asp:GridView>
        </div>
    </form>
</body>
</html>

 

View 1 Replies View Related

Why Can't I Enable Editing On A Gridview That Gets It's Data From A View Through An SqlDataSource?

Nov 22, 2007

Hi,
I think the title explains it all really. I cannot configure the SqlDataSource to add Insert, Update and Delete statements - not through the wizard anyway.
The view combines two tables, each containing 3 columns. I have tried using different combinations of columns, and ended up selecting all of them (making sure the foreign key column of the first table was given a different alias to the primary key column of the second table) but I still cannot enable editing.
Cheers,
Patrick

View 3 Replies View Related

Sqldatasource, Does It Select If Not Bound To A Gridview, Formview On The Page?

Feb 22, 2008

Using 3.5
If I have a sqldatasource on the page, is it run if it is not bound to a data object like a gridview?
Seems like if i want to access the data (like set a label text) from the sqldatasource I have to use code to first create a dataview then pick throught it. This seems like I'm running it twice. I'm new at .net so I dont know how to tell.
I don't want to write data select code programatically when I can just through an SDS on the page, but wondered it it ran just because it's on the page.

View 2 Replies View Related

Prevent Loading Sqldatasource And Populating Gridview On Pageload

Apr 9, 2006

Hi,
I got a page with 3 sqldatasources and 2 dropdownlists and 1 gridview.
2 sqldatasources may load when the page load adn fill in the 2 DDL's.
But 1 sqldatasource and the gridview may only be loaded when I press a button. This is because otherwise every time I load the page more then 5000 records. (the 2 DDL's are filters for the 3th sqldatasource)
Anyone an idea how to solve this problem?
Best regards,
Karel

View 3 Replies View Related

GridView Delete Function

Jun 28, 2007

This is killing me. I've searched the forums for hours and can't find the answer. My SQLDataSource is working fine except when I want to delete. I've allowed the delete function to be shown on the gridview. This is my SQLDataSource: <asp:SqlDataSource ID="IndexDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:IndexConnectionString %>"
SelectCommand="SELECT *
FROM [Index]
WHERE (Type LIKE '%' + @SearchText2 + '%')
OR (Product LIKE '%' + @SearchText2 + '%')
OR (Version LIKE '%' + @SearchText2 + '%')
OR (Binder LIKE '%' + @SearchText2 + '%')
OR (Language LIKE '%' + @SearchText2 + '%')
OR (CDName LIKE '%' + @SearchText2 + '%')
OR (Details LIKE '%' + @SearchText2 + '%')
OR (ISOLink LIKE '%' + @SearchText2 + '%')"
DeleteCommand="DELETE FROM [Index] WHERE [ID] = @original_ID"
UpdateCommand="UPDATE [Index] SET Type = @Type, Product = @Product , Version = @Version, Binder = @Binder, Language = @Language, CDName = @CDName, Details = @Details, ISOLink = @ISOLink WHERE ID = @ID">
<SelectParameters>
<asp:ControlParameter Name="SearchText2" Type="String" ControlID="SearchText2" PropertyName="Text" ConvertEmptyStringToNull="False" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="original_ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Type" />
<asp:Parameter Name="Product" />
<asp:Parameter Name="Version" />
<asp:Parameter Name="Binder" />
<asp:Parameter Name="Language" />
<asp:Parameter Name="CDName" />
<asp:Parameter Name="Details" />
<asp:Parameter Name="ISOLink" />
</UpdateParameters>

</asp:SqlDataSource>
  It doesn't give me an error if I click delete but it doesn't delete the record. I've tried changing the DeleteParameter to <asp:Parameter Name="ID" Type="Int32" /> but it gives me the error "Must declare the scaler variable of '@ID'"... I saw in this post http://forums.asp.net/p/1077738/1587043.aspx#1587043 that the answer was that "The variable you have declared in the definition of the proc is
different from the variable you are using in the WHERE clause." when they are both the same. Thanks for any help.-Brandan   

View 4 Replies View Related

Retrieving Selected Gridview Column Values For SQLDatasource Asp:controlparameters

Jun 12, 2006

Not sure if this is the correct forum, but I 'm having problems retrieving a sqldatasource's asp:control parameter values from a selected row (during edit) in a gridview to update a record thru a stored procedure.  The stored procedure is pretty intense, so I'd like to keep it in SQL if possible instead of creating the generic "update table set ..." that I see in most examples.  It seems as if I can't get the propertyname right or something because it keeps giving me a "Procedure or function XX has too many arguments specified error".  Maybe the DataKeyNames is not right??  I've tried just passing one parameter (ProductID-same as DataKeyNames) using "SelectedValue" as propertyname and still get the same.  It's got to be something very simple, but I'm at a loss.  All parameters are spelled the same in the sp (with an added "@" at start) as in the asp:controlparameters.  Here's the gridview (asp.net 2.0 connecting to SQL Server 2005):
<asp:GridView ID="gvLoadEditProductPrices" runat="server" AutoGenerateColumns="False" AllowSorting="True" DataSourceID="SqlDataSource1" DataKeyNames="ProductID">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID" HeaderStyle-BackColor="white" InsertVisible="False"
ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="Product" HeaderText="Product" SortExpression="Product" ReadOnly="True" />
<asp:BoundField DataField="ProductCat" HeaderText="ProductCat" SortExpression="ProductCat" ReadOnly="True" />
<asp:BoundField DataField="VarRate" HeaderText="VarRate" SortExpression="VarRate" />
<asp:BoundField DataField="loadid" HeaderText="loadid" InsertVisible="False" ReadOnly="True"
SortExpression="loadid" />
<asp:BoundField DataField="loadamount" HeaderText="loadamount" SortExpression="loadamount" ReadOnly="True" />
<asp:BoundField DataField="ProductCol" HeaderText="ProductCol" SortExpression="ProductCol" ReadOnly="True" />
<asp:BoundField DataField="PageID" HeaderText="PageID" SortExpression="PageID" ReadOnly="True" />
</Columns>
</asp:GridView>
and the sqldatasource's info:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MARSProductEditor %>" ProviderName="System.Data.SqlClient" SelectCommand="spGetLoadEditProductPrices" SelectCommandType="StoredProcedure" UpdateCommand="spUpdateProductPrices" UpdateCommandType="StoredProcedure" >
<UpdateParameters>
<asp:ControlParameter Name="ProductID" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("ProductID")></asp:ControlParameter>
<asp:ControlParameter Name="LoadID" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("LoadID")></asp:ControlParameter>
<asp:ControlParameter Name="PageID" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("PageID")></asp:ControlParameter>
<asp:ControlParameter Name="ProductCol" Type="Int32" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("ProductCol")></asp:ControlParameter>
<asp:ControlParameter Name="NewRate" Type="Double" ControlID="gvLoadEditProductPrices" PropertyName=SelectedDataKey.Values("NewRate")></asp:ControlParameter>
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="ddlEstLoadsPerAcre" Name="LoadID" PropertyName="SelectedValue"
Type="Int32" />
<asp:ControlParameter ControlID="txtEditType" Name="PageName" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
 
TIA,
John

View 1 Replies View Related

GridView Wont Delete Or Update

Nov 15, 2006

I have had this problem before but it turned out to be dodgy SQL created by the wizard. Doesn't seem to be the case this time.The following does a postback but makes no changes.  1 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ehlConnectionString %>"
2 DeleteCommand="DELETE FROM [tblSubRegions] WHERE [SubRegionID] = ?"
3 InsertCommand="INSERT INTO [tblSubRegions] ([SubRegionID], [RegionID], [SubRegionName]) VALUES (?, ?, ?)"
4 ProviderName="<%$ ConnectionStrings:ehlConnectionString.ProviderName %>"
5 SelectCommand="SELECT tblSubRegions.SubRegionID, tblSubRegions.RegionID, tblSubRegions.SubRegionName, tblRegions.RegionName FROM (tblSubRegions INNER JOIN tblRegions ON tblSubRegions.RegionID = tblRegions.RegionID) WHERE (tblSubRegions.RegionID = ?) ORDER BY tblSubRegions.SubRegionName"
6 UpdateCommand="UPDATE [tblSubRegions] SET [RegionID] = ?, [SubRegionName] = ? WHERE [SubRegionID] = ?">
7
8 <DeleteParameters>
9 <asp:Parameter Name="SubRegionID" Type="Int32" />
10 </DeleteParameters>
11
12 <UpdateParameters>
13 <asp:Parameter Name="RegionID" Type="Int32" />
14 <asp:Parameter Name="SubRegionName" Type="String" />
15 <asp:Parameter Name="SubRegionID" Type="Int32" />
16 </UpdateParameters>
17
18 <SelectParameters>
19 <asp:ControlParameter ControlID="dropRegions" Name="RegionID" PropertyName="SelectedValue" Type="Int32" />
20 </SelectParameters>
21
22 <InsertParameters>
23 <asp:Parameter Name="SubRegionID" Type="Int32" />
24 <asp:Parameter Name="RegionID" Type="Int32" />
25 <asp:Parameter Name="SubRegionName" Type="String" />
26 </InsertParameters>
27
28 </asp:SqlDataSource>
29
30
31
32 <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ehlConnectionString %>"
33 ProviderName="<%$ ConnectionStrings:ehlConnectionString.ProviderName %>"
34 SelectCommand="SELECT [RegionID], [RegionName] FROM [tblRegions]">
35
36 </asp:SqlDataSource>
37
38
39
40 <asp:DropDownList id="dropStates" runat="server" OnSelectedIndexChanged="dropStates_SelectedIndexChanged" AutoPostBack="True">
41 </asp:DropDownList>
42
43 <asp:DropDownList id="dropRegions" runat="server" OnSelectedIndexChanged="dropRegions_SelectedIndexChanged" AutoPostBack="True">
44 </asp:DropDownList>
45
46
47
48 <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
49 AutoGenerateColumns="False" EnableViewState=false Width="100%" DataSourceID="SqlDataSource1">
50 <Columns>
51 <asp:TemplateField HeaderText="SubRegionName" SortExpression="SubRegionName">
52 <EditItemTemplate>
53 <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
54 DataTextField="RegionName" DataValueField="RegionID" SelectedValue='<%# Bind("RegionID") %>'>
55 </asp:DropDownList>
56 </EditItemTemplate>
57 <ItemTemplate>
58 <asp:Label ID="Label1" runat="server" Text='<%# Bind("SubRegionName") %>'></asp:Label>
59 </ItemTemplate>
60 </asp:TemplateField>
61 <asp:BoundField DataField="RegionName" HeaderText="RegionName" SortExpression="RegionName" />
62 <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
63 </Columns>
64 </asp:GridView>
 Thanks in advance. Shaun 

View 1 Replies View Related

Problem With Delete Function Within A Gridview

Mar 1, 2007

I've got an issue that when I update a record in the gridview it works fine.  When I click the delete link to remove the record from the database, I get the following error, "System.FormatException: Input string was not in a correct format".  Part of the Stack Trace refers to "String oldValuesParameterFormatString".  This parameter is in my SqlDataSource.  It was dynamically created when I originally created the SqlDataSource with VWD 2005 Express Edition.  The delete function will work if I remove "OldValuesParameterFormatString="original_{0}" ProviderName="System.Data.SqlClient", and any reference to "original_" in the DeleteCommand the SqlDataSource.  But if I do, the update function doesn't work.  Anyway, here's the SqlDataSource:  Any help would be greatly appreciated!!!!!
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>"
DeleteCommand="DELETE FROM [houses] WHERE [intID] = @original_intID AND [street] = @original_street AND [city] = @original_city AND [state] = @original_state AND [zip] = @original_zip AND [status] = @original_status AND [pDate] = @original_pDate AND [sPrice] = @original_sPrice AND [asPrice] = @original_asPrice AND [actSalePrice] = @original_actSalePrice AND [cToDate] = @original_cToDate AND [rehabBudget] = @original_rehabBudget AND [tDay] = @original_tDay AND [eDate] = @original_eDate AND [loDate] = @original_loDate AND [rsDate] = @original_rsDate AND [flooringDate] = @original_flooringDate AND [estCompDate] = @original_estCompDate AND [actCompDate] = @original_actCompDate AND [coe] = @original_coe AND [lDate] = @original_lDate AND [credits] = @original_credits AND [agent] = @original_agent AND [insComplete] = @original_insComplete AND [cEscrowDate] = @original_cEscrowDate AND [bidValue] = @original_bidValue AND [thomGuideNumber] = @original_thomGuideNumber AND [locksmith] = @original_locksmith AND [notes] = @original_notes AND [hoa] = @original_hoa"
 
InsertCommand="INSERT INTO [houses] ([street], [city], [state], [zip], [status], [pDate], [sPrice], [asPrice], [actSalePrice], [cToDate], [rehabBudget], [tDay], [eDate], [loDate], [rsDate], [flooringDate], [estCompDate], [actCompDate], [coe], [lDate], [credits], [agent], [insComplete], [cEscrowDate], [bidValue], [thomGuideNumber], [locksmith], [notes], [hoa]) VALUES (@street, @city, @state, @zip, @status, @pDate, @sPrice, @asPrice, @actSalePrice, @cToDate, @rehabBudget, @tDay, @eDate, @loDate, @rsDate, @flooringDate, @estCompDate, @actCompDate, @coe, @lDate, @credits, @agent, @insComplete, @cEscrowDate, @bidValue, @thomGuideNumber, @locksmith, @notes, @hoa)"
OldValuesParameterFormatString="original_{0}" ProviderName="System.Data.SqlClient"
SelectCommand="SELECT * FROM [houses] WHERE ([intID] = @intID)"
UpdateCommand="UPDATE [houses] SET [street] = @street, [city] = @city, [state] = @state, [zip] = @zip, [status] = @status, [pDate] = @pDate, [sPrice] = @sPrice, [asPrice] = @asPrice, [actSalePrice] = @actSalePrice, [cToDate] = @cToDate, [rehabBudget] = @rehabBudget, [tDay] = @tDay, [eDate] = @eDate, [loDate] = @loDate, [rsDate] = @rsDate, [flooringDate] = @flooringDate, [estCompDate] = @estCompDate, [actCompDate] = @actCompDate, [coe] = @coe, [lDate] = @lDate, [credits] = @credits, [agent] = @agent, [insComplete] = @insComplete, [cEscrowDate] = @cEscrowDate, [bidValue] = @bidValue, [thomGuideNumber] = @thomGuideNumber, [locksmith] = @locksmith, [notes] = @notes, [hoa] = @hoa WHERE [intID] = @original_intID">
<DeleteParameters><asp:Parameter Name="original_intID" Type="Int32" /><asp:Parameter Name="original_street" Type="String" /><asp:Parameter Name="original_city" Type="String" /><asp:Parameter Name="original_state" Type="String" /><asp:Parameter Name="original_zip" Type="String" /><asp:Parameter Name="original_status" Type="String" /><asp:Parameter Name="original_pDate" Type="DateTime" /><asp:Parameter Name="original_sPrice" Type="Decimal" /><asp:Parameter Name="original_asPrice" Type="Decimal" /><asp:Parameter Name="original_actSalePrice" Type="Decimal" /><asp:Parameter Name="original_cToDate" Type="Decimal" /><asp:Parameter Name="original_rehabBudget" Type="Decimal" /><asp:Parameter Name="original_tDay" Type="DateTime" /><asp:Parameter Name="original_eDate" Type="DateTime" /><asp:Parameter Name="original_loDate" Type="DateTime" /><asp:Parameter Name="original_rsDate" Type="DateTime" /><asp:Parameter Name="original_flooringDate" Type="DateTime" /><asp:Parameter Name="original_estCompDate" Type="DateTime" /><asp:Parameter Name="original_actCompDate" Type="DateTime" /><asp:Parameter Name="original_coe" Type="DateTime" /><asp:Parameter Name="original_lDate" Type="DateTime" /><asp:Parameter Name="original_credits" Type="String" /><asp:Parameter Name="original_agent" Type="String" /><asp:Parameter Name="original_insComplete" Type="String" /><asp:Parameter Name="original_cEscrowDate" Type="DateTime" /><asp:Parameter Name="original_bidValue" Type="Decimal" /><asp:Parameter Name="original_thomGuideNumber" Type="String" /><asp:Parameter Name="original_locksmith" Type="String" /><asp:Parameter Name="original_notes" Type="String" /><asp:Parameter Name="original_hoa" Type="String" /></DeleteParameters>
<UpdateParameters><asp:Parameter Name="street" Type="String" /><asp:Parameter Name="city" Type="String" /><asp:Parameter Name="state" Type="String" /><asp:Parameter Name="zip" Type="String" /><asp:Parameter Name="status" Type="String" /><asp:Parameter Name="pDate" Type="DateTime" /><asp:Parameter Name="sPrice" Type="Decimal" /><asp:Parameter Name="asPrice" Type="Decimal" /><asp:Parameter Name="actSalePrice" Type="Decimal" /><asp:Parameter Name="cToDate" Type="Decimal" /><asp:Parameter Name="rehabBudget" Type="Decimal" /><asp:Parameter Name="tDay" Type="DateTime" /><asp:Parameter Name="eDate" Type="DateTime" /><asp:Parameter Name="loDate" Type="DateTime" /><asp:Parameter Name="rsDate" Type="DateTime" /><asp:Parameter Name="flooringDate" Type="DateTime" /><asp:Parameter Name="estCompDate" Type="DateTime" /><asp:Parameter Name="actCompDate" Type="DateTime" /><asp:Parameter Name="coe" Type="DateTime" /><asp:Parameter Name="lDate" Type="DateTime" /><asp:Parameter Name="credits" Type="String" /><asp:Parameter Name="agent" Type="String" /><asp:Parameter Name="insComplete" Type="String" /><asp:Parameter Name="cEscrowDate" Type="DateTime" /><asp:Parameter Name="bidValue" Type="Decimal" /><asp:Parameter Name="thomGuideNumber" Type="String" /><asp:Parameter Name="locksmith" Type="String" /><asp:Parameter Name="notes" Type="String" /><asp:Parameter Name="hoa" Type="String" /><asp:Parameter Name="original_intID" Type="Int32" /><asp:Parameter Name="original_street" Type="String" /><asp:Parameter Name="original_city" Type="String" /><asp:Parameter Name="original_state" Type="String" /><asp:Parameter Name="original_zip" Type="String" /><asp:Parameter Name="original_status" Type="String" /><asp:Parameter Name="original_pDate" Type="DateTime" /><asp:Parameter Name="original_sPrice" Type="Decimal" /><asp:Parameter Name="original_asPrice" Type="Decimal" /><asp:Parameter Name="original_actSalePrice" Type="Decimal" /><asp:Parameter Name="original_cToDate" Type="Decimal" /><asp:Parameter Name="original_rehabBudget" Type="Decimal" /><asp:Parameter Name="original_tDay" Type="DateTime" /><asp:Parameter Name="original_eDate" Type="DateTime" /><asp:Parameter Name="original_loDate" Type="DateTime" /><asp:Parameter Name="original_rsDate" Type="DateTime" /><asp:Parameter Name="original_flooringDate" Type="DateTime" /><asp:Parameter Name="original_estCompDate" Type="DateTime" /><asp:Parameter Name="original_actCompDate" Type="DateTime" /><asp:Parameter Name="original_coe" Type="DateTime" /><asp:Parameter Name="original_lDate" Type="DateTime" /><asp:Parameter Name="original_credits" Type="String" /><asp:Parameter Name="original_agent" Type="String" /><asp:Parameter Name="original_insComplete" Type="String" /><asp:Parameter Name="original_cEscrowDate" Type="DateTime" /><asp:Parameter Name="original_bidValue" Type="Decimal" /><asp:Parameter Name="original_thomGuideNumber" Type="String" /><asp:Parameter Name="original_locksmith" Type="String" /><asp:Parameter Name="original_notes" Type="String" /><asp:Parameter Name="original_hoa" Type="String" /></UpdateParameters>
<SelectParameters><asp:QueryStringParameter Name="intID" QueryStringField="intID" Type="Int32" /></SelectParameters>
<InsertParameters><!-- removed to save space --></InsertParameters>
</asp:SqlDataSource>

View 4 Replies View Related

How To Enable Update, Delete In Gridview

Jan 2, 2008

Hi all,Happy New Year!I've just install VS .NET 2005 and try to play with Gridviewwhen I configure the datasource for Gridview and click "Advance" in order to enable Update, Delete Select etc...the checkBox is not selectableCan someone pls show me how?Thanks in advance.

View 2 Replies View Related

Gridview - Delete Row - Autoincrement Problem

Mar 25, 2008

Hi,
I have a table (Table1) with an autoincrement column (sql server 2005) and in my asp .net code (c#) the user can delete a row (record) in gridview (by clicking on delete link).
The problem is that every time if the user adds a new record in gridview the new row has a wrong number.
What I mean is:
Table1 has two columns: ID and Category
ID Category1 test12 test23 test3 -> delete this row
Now insert a new row:
ID Category1 test12 test24 test3 -> ID is 4, but it should be 3
Could anyone help me please?
Thank you in advance!
Best regardKlaus
 

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved