UPDATE/DELETE Bug In SqlDataSource - Will Microsoft Ever Fix This?

Aug 3, 2006

I'm referring to this bug, which I've seen a lot of people (including me) run into:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93937

Has anyone heard if MS plans to fix this soon?

Thanks

View 3 Replies


ADVERTISEMENT

SqlDataSource: Insert, Update And Delete Not Available

Jan 3, 2006

Hello Guys,
 
I’m trying to create a sqlDataSource using the wizard, I can get the select statement, the here clause and the order by clause but when I click on the Advanced button the options to generate the insert, update and delete statements are not available. Does anyone know what am I doing wrong?

View 4 Replies View Related

SqlDataSource Not Allowing Insert, Update And Delete

Jul 4, 2006

i have default.aspx file and i put SqlDataSource into my designer form.when i want to configure SqlDataSource it not allowed my to insert, update and delete only insert is allowed.what is the problem and the solution for this case ...thx

View 1 Replies View Related

My SQLDataSource Select/Update/Insert/Delete

Jan 18, 2008

hi
i have form view that retrieves a single row
i dont want to use SQLDataSource default Select/Update/Insert/Delete buttons
i am using Stored Procedures
I want to have my own buttons, the select has parameters, how to retrieve data for that parameter?
 

View 6 Replies View Related

SqlDataSource: Can't Gen INSERT/UPDATE/DELETE Statements; Using 2.0 Membership Aspnetdb

Jul 20, 2006

Hi,I'm new to ASP.NET and having a problem configuring the SqlDataSource control.  I am using the standard ASP.NET 2.0 "aspnetdb" database to manage user accounts.  The problem is this:When using the wizard to configure my SqlDataSource control, the option to auto-generate the Insert/Update/Delete SQL statements are grayed out.   I've searched this forum and found that this can be a symptom of no primary keys in the tables.  However, there are primary keys (UserId), which is the default schema as generated by asp.net (aspnet_regsql.exe).  When I use the wizard, I make the following choices:How would you like to retrieve data from your database?-> Select "Specify columns from a table or view"-> Select the "vw_aspnet_MembershipUsers" view from the "Name:" drop-down list-> Select "UserId", "Email", "UserName"  from "Columns:"After this, still no option to auto-generate I/U/D statements.  Any thoughts on why this isn't working??? Thanks,Leah.

View 1 Replies View Related

SqlDataSource Insert, Update Delete Options Are Dimmed In Configure DataSource Control

Mar 23, 2008

I can select the tables and fields, but when I click on Advanced the Check Box to Create the Commands is not available. they are dimmed out.
Why is this happening, is it a setting that I have missed. Any help is appreciated.

View 1 Replies View Related

Help On Displaying Data From Sqldatasource As Microsoft SQL Server (SQLClient)

Jul 26, 2007

             <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NWHCConnectionString %>"                SelectCommand="SELECT * FROM [AI_news]" OnSelecting="SqlDataSource1_Selecting">            </asp:SqlDataSource> This is my code, I have followed the wizard perfectly the way its supposed ot be, well not 100% perfectly. This is how its supposed to be. When using a XXXX.MDF file I could use the wizard and it works fine. I do not know why my above code won't work. I am connected to the database and can view code manually. but not on a aspx page. i am using master page, now trying to add this into default.aspx Any help will be appreciated. I am currently losing some hair. 

View 4 Replies View Related

Need Help With Sqldatasource (delete)

Jan 19, 2007

I have a sqldatasource that I have just inserted some rows into via the:
sqldatasource.insertparameters("devicename").defaultvalue = "SERVERNAME"
sqldatasource.insert()
 
I now want to via a list of machines, delete certain ones from the sqldatasource above.  I tried the following but it is failing.. any thoughts as to why?
sqldatasource.selectparameters=("devicename").defaultvalue = "SERVERNAME"
sqldatasource.select(datasourceselectarguments.empty)
sqldatasource.deleteparameters("devicename").defaultvalue = "SERVERNAME"
sqldatasource.delete()
I may be going about this totally wrong, I'm a bit new to this...  I just want to select the row from the table that = "SERVERNAME" and then delete it.  I have enabled inserts/updates/deletes in my datasource...
 
thanks
Stan

View 5 Replies View Related

How To Create A Update Button To Update Two SqlDataSource Controls?

May 10, 2006

I want to update two tables in one page. So I created two FormView bound on two SqlDataSource controls, and I create a Update button on the bottom of page. And I writen some codes as below:
btnUpate_Click(object sender, EventArgs e){
   sqlDataSource1.Update();
   sqlDateSource2.Update();}
But, the records haven't updated.
In SqlDataSource2_Updating() function, I found all the parameters is null.
So, how to modify my code to do it.
 
Zhang

View 2 Replies View Related

Runtime Sqldatasource Delete Command

Aug 12, 2006

i need to dyanamically generate my SQL commands so to do that i am generating sqldatasource commands programmatically rather declaratively. SELECT commands seems to work fine but DELETE isnt doing anything, here is my code:
 
SqlDataSource sdsConsultant = new SqlDataSource();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
loadDataSet();  //it just loads dataset used by formview
initializeSDS();
}


}
protected void initializeSDS()
{
string strConnection = ConfigurationManager.ConnectionStrings["myDB"].ToString();
sdsConsultant.ConnectionString = strConnection;

//SELECT
sdsConsultant.SelectCommand = "SELECT * FROM Consultants WHERE (id=@id)";
QueryStringParameter id = new QueryStringParameter("id", "id");
sdsConsultant.SelectParameters.Add(id);

//DELETE
sdsConsultant.DeleteCommand = "DELETE * FROM Consultants WHERE (id=@id2)";
QueryStringParameter id2 = new QueryStringParameter("id2", "id");
sdsConsultant.DeleteParameters.Add(id2);

//UPDATE
Page.Controls.Add(sdsConsultant);
FormView1.DataSource = sdsConsultant;
FormView1.DataBind();
}
 
my formview control looks like:
<asp:FormView DefaultMode="Edit" ID="FormView1" runat="server" DataKeyNames="id"
OnItemDeleted="FormView1_ItemDeleted"
OnItemDeleting="FormView1_ItemDeleting">
 
the DELETE doesnt execute and the OnItemDeleted event doesnt do anything either. am i doing something wrong here? plz help
 

View 2 Replies View Related

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 fallowsDeleteCommand="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 View Related

Get @@rowcount Data From MSSQL Using SqlDataSource With Delete Command

Mar 8, 2007

HiI'm using a simple SqlDataSource to connect to a stored proc to delete a number of rows from different tables.In my SQL im using: DECLARE @table1Count int

DELETE FROM Table1 WHERE id = @new_id

SET @table1Count=@@rowcount

SELECT @table1Count  I'm then using an input box and linking it to the delete control parameter.  Then on a button click event i'm running SqlDataSource1.Delete() which all works fine.  But how do i get the @table1Count back into my aspx page? Thanks 

View 3 Replies View Related

Microsoft UPDATE BUG When Only One Row?

Mar 30, 2001

The update statement is failing with Timeout expired when there is only one row to update, otherwise if there are multiple rows to update it does not update the first row but updates the rest!!!??

Update cm_event_notification Set processed = '3/29/01 10:41:01 AM' Where dn = '{2E738808-23B4-11D5-B49A-00508BD934F8}'

View 1 Replies View Related

Update Not Working In An SQLDataSource

Sep 6, 2006

I'm new to ASP and ASP.NET so I used the Wizards in Visual Web Deverlopment Express 2005 to build the following code:<asp:DetailsView ID="DetailsView" runat="server" DataSourceID="TracksDataSource"
Height="50px" Width="125px" AutoGenerateEditButton="True" AutoGenerateRows="False">
<Fields>
<asp:BoundField DataField="pk_trackID" HeaderText="pk_trackID" ReadOnly="True" SortExpression="pk_trackID" />
<asp:BoundField DataField="trackName" HeaderText="trackName" SortExpression="trackName" />
<asp:BoundField DataField="trackPath" HeaderText="trackPath" SortExpression="trackPath" />
<asp:BoundField DataField="lyrics" HeaderText="lyrics" SortExpression="lyrics" />
</Fields>
</asp:DetailsView>

<asp:SqlDataSource ID="TracksDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:connectionString %>"
SelectCommand="SELECT * FROM [Tracks] WHERE ([pk_trackID] = @pk_trackID)" UpdateCommand="UPDATE [Tracks] SET [trackName] = @trackName, [trackPath] = @trackPath, [lyrics] = @lyrics WHERE [pk_trackID] = @pk_trackID" >
<UpdateParameters>
<asp:Parameter Name="trackName" Type="String" />
<asp:Parameter Name="trackPath" Type="String" />
<asp:Parameter Name="lyrics" Type="String" />
<asp:Parameter Name="pk_trackID" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TracksListBox" Name="pk_trackID" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>  However, when I click Edit, change something, and then Update it doesn't update the database. However, if I remove the DataField bindings and use the AutoGenerateRows feature it works fine.

View 7 Replies View Related

Using XML As An Update Parameter In A SqlDataSource?

Nov 6, 2006

One of the requirements of the UpdateParameters for a GridView I'm building is that the fields that are being edited via EditItemTemplates are passed back to the UpdateParameter as XML. How would I go about combining the fields from the GridView/EditItems into an XML string that I can set as an asp:Parameter?
Thanks.

View 1 Replies View Related

OldValuesParameterFormatString SqlDataSource Update

Mar 15, 2007

OK guys, I'm sure I'm doing something stupid here but after 2 days I find myself extremely frusted... Any help would be appreciated
I'm tring to write an update procedure for an SqlDataSource control that will allow me to chage the primary key values of a record in the table. Everything seems to work fine with the exception of obtaining the old values (the primary key before its changed by the end user) during the update. I've read several articles on the web an in the forums on this topic. Much of it has to do with the .NET beta version alteration from "original_{0}" to "{0}". I believe those conversations do not describe my problem.
Anyhow, onto some source code. Here's the ASP source code for a grid view and sql data source. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="productName,productURL" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display.">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="productName" HeaderText="productName" ReadOnly="True"
SortExpression="productName" />
<asp:BoundField DataField="productURL" HeaderText="productURL" ReadOnly="True" SortExpression="productURL" />
<asp:BoundField DataField="productSupportURL" HeaderText="productSupportURL" SortExpression="productSupportURL" />
<asp:BoundField DataField="description" HeaderText="description" SortExpression="description" />
<asp:BoundField DataField="modified" HeaderText="modified" SortExpression="modified" />
<asp:BoundField DataField="userid" HeaderText="userid" SortExpression="userid" />
<asp:BoundField DataField="useridDomain" HeaderText="useridDomain" SortExpression="useridDomain" />
<asp:BoundField DataField="sortOrder" HeaderText="sortOrder" SortExpression="sortOrder" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SBAAdminConnectionString1 %>"
DeleteCommand="DELETE FROM [homePageList] WHERE [productName] = @old_productName AND [productURL] = @old_productURL"
InsertCommand="INSERT INTO [homePageList] ([productName], [productURL], [productSupportURL], [description], [modified], [userid], [useridDomain], [sortOrder]) VALUES (@productName, @productURL, @productSupportURL, @description, @modified, @userid, @useridDomain, @sortOrder)"
ProviderName="<%$ ConnectionStrings:SBAAdminConnectionString1.ProviderName %>"
SelectCommand="SELECT [productName], [productURL], [productSupportURL], [description], [modified], [userid], [useridDomain], [sortOrder] FROM [homePageList]"
UpdateCommand="UPDATE homePageList SET productSupportURL = @productSupportURL, description = @description, modified = @modified, userid = @userid, useridDomain = @useridDomain, sortOrder = @sortOrder, productName = @productName, productURL = @productURL WHERE (productName = @original_productName) AND (productURL = @original_productURL)" OldValuesParameterFormatString="original_{0}">
<DeleteParameters>
<asp:Parameter Name="old_productName" Type="String" />
<asp:Parameter Name="old_productURL" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="modified" Type="DateTime" />
<asp:Parameter Name="userid" Type="String" />
<asp:Parameter Name="useridDomain" Type="String" />
<asp:Parameter Name="sortOrder" Type="Single" />
<asp:Parameter Name="productName" Type="String" />
<asp:Parameter Name="productURL" Type="String" />
<asp:Parameter Name="productSupportURL" Type="String" />
<asp:ControlParameter ControlID="GridView1" Direction="InputOutput" Name="original_productName"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="GridView1" Direction="InputOutput" Name="original_productURL"
PropertyName="SelectedValue" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="productName" Type="String" />
<asp:Parameter Name="productURL" Type="String" />
<asp:Parameter Name="productSupportURL" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="modified" Type="DateTime" />
<asp:Parameter Name="userid" Type="String" />
<asp:Parameter Name="useridDomain" Type="String" />
<asp:Parameter Name="sortOrder" Type="Single" />
</InsertParameters>
</asp:SqlDataSource>I added a text box for every field in the grid to the form and update the fields when the user selects a record in the GridView. I then added an Update button to the form and tied the event to this procedure:  Protected Sub bUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bUpdate.Click
'if the user has not entered key fields!
If missingKeyFields() Then
Exit Sub

End If

Dim count, so As Integer
Dim uDomain, uid As String

'parse out the user id and domain.
Try
If HttpContext.Current.User.Identity.Name = "" Then
uid = "unknow"
uDomain = "unknown"

Else
uid = HttpContext.Current.User.Identity.Name
uid = uid.Substring(uid.IndexOf("") + 1)
uDomain = uid.Substring(0, uid.IndexOf("") - 1)

End If

Catch ex As Exception
uid = "unknow"
uDomain = "unknown"

End Try

'fill in the parameters
'@productName, @productURL, @productSupportURL, @description, @modified, @userid, @useridDomain, @sortOrder
Me.SqlDataSource1.UpdateParameters.Item("productName").DefaultValue = Me.tbProductName.Text
Me.SqlDataSource1.UpdateParameters.Item("productURL").DefaultValue = Me.tbProductURL.Text
Me.SqlDataSource1.UpdateParameters.Item("productSupportURL").DefaultValue = Me.tbProductSupportURL.Text
Me.SqlDataSource1.UpdateParameters.Item("description").DefaultValue = Me.tbProductDescription.Text
Me.SqlDataSource1.UpdateParameters.Item("modified").DefaultValue = Now
Me.SqlDataSource1.UpdateParameters.Item("userid").DefaultValue = uid
Me.SqlDataSource1.UpdateParameters.Item("useridDomain").DefaultValue = uDomain
Me.SqlDataSource1.UpdateParameters.Item("sortOrder").ConvertEmptyStringToNull = True

If Integer.TryParse(Me.tbSortOrder.Text, so) Then
Me.SqlDataSource1.UpdateParameters.Item("sortOrder").DefaultValue = so

Else
Me.SqlDataSource1.UpdateParameters.Item("sortOrder").DefaultValue = ""

End If

'insert the record.
count = Me.SqlDataSource1.Update()
Me.lCommandInfo.Text = count.ToString + " record was updated."

End Sub
 The net result of the procedure is the message "0 record was updated." when I select a record in the gridView and then edit the "productName" field and click Update.
In an attempt to trace down the problem I added this code: Protected Sub SqlDataSource1_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Updating

Message.Text = e.Command.CommandText
Message.Text += "<br>"
For lp As Integer = 0 To e.Command.Parameters.Count - 1
Message.Text += e.Command.Parameters(lp).ParameterName + "=" + e.Command.Parameters(lp).Value
Message.Text += "<br>"

Next

End Sub
The message label displays the following text:UPDATE homePageList SET productSupportURL = @productSupportURL, description = @description, modified = @modified, userid = @userid, useridDomain = @useridDomain, sortOrder = @sortOrder, productName = @productName, productURL = @productURL WHERE (productName = @original_productName) AND (productURL = @original_productURL)
@description=interesting!
@modified=3/15/2007 4:07:31 PM
@userid=unknow
@useridDomain=unknown
@sortOrder=
@productName=ok22
@productURL=http
@productSupportURL=http
@original_productName=ok
@original_productURL=ok
Notice how the "@original_productURL" has the same value as the "@original_productName"? This should not be the case. The @original_productURL should equal "http" since I didn't update the field's value. It seems like the second field of the primary key is not getting updated or passed to the @original_productURL parameter. Since .NET handles the @original_{0} parameters I don't know why the field isn't being properly updated.
Any thoughts on how to track down the root cause of my problem... Or better yet any thoughts on a work around to my problem?
Thanks,Johnny

View 5 Replies View Related

Need Help With SQLDataSource Update Parameter

Jun 14, 2007

I need to know how to setup the ControlParameter for a template control in my Gridview? I have a datepicker in my template and I need to know how to refer to it in the ControlParameter of the SQLDataSource control.
  <UpdateParameters>
<asp:ControlParameter Name="dp_start" ControlID="bdpPlanStart" PropertyName="SelectedValue" Type="Datetime" />  Here is the template:<asp:TemplateField HeaderText="Start" SortExpression="dp_start">
<ItemTemplate>
<%#DataBinder.Eval(Container, "DataItem.dp_start", "{0:d}")%>
</ItemTemplate>
<EditItemTemplate>
<BDP:BasicDatePicker id="bdpPlanStart" SelectedValue='<%# DataBinder.Eval(Container.DataItem,"dp_start") %>' runat="server" DateFormat="d">
</BDP:BasicDatePicker>
</EditItemTemplate>
</asp:TemplateField>  

View 1 Replies View Related

How To Update SqlDataSource Query

Nov 7, 2007

I am trying to reload an AJAX control without reloading the page.  This question may belong under AJAX,  but I'm not sure if I'm managing the SqlDataSource correctly.  I want to set the SelectCommand to a new SQL statement and refresh the form on the screen.  My code is below.  It doesn't seem to be working.  Do I need to call something else or is this correct and the problem is with that nasty AJAX?SqlDataSource oSqlDataSource1 = (SqlDataSource) oContentPlaceHolder1.FindControl("SqlDataSource1");oSqlDataSource1.SelectCommand = "SELECT * FROM WorkHistory WHERE WorkHistoryID = " + sWorkHistoryID;oSqlDataSource1.Select(DataSourceSelectArguments.Empty);

View 2 Replies View Related

Two Update Commands For A SqlDataSource?

Jan 16, 2008

Is there a way to have two sql update commands so I can use both during an update depending on which row it is?

View 1 Replies View Related

SqlDataSource Won't Update Table

Feb 8, 2008

I have a number of textboxes in a WizardStep of my CreateUserWizard and I can't update the contents to the database (see below for an example). Any suggestions would be appreciated. Dim txt As TextBox = cuwMoreInfo.FindControl("txtAddress")
srcMoreInfo.UpdateParameters("Address").DefaultValue = DirectCast(txt, TextBox).Text 

View 12 Replies View Related

Sqldatasource Update() Method

Apr 5, 2008

Hi All, 
i want to use sqldatasource with controlparameters.there are some textboxes and a dropdownlist on my page.i can easily insert and delete records on database table by using these controls as controlparameters by sqldatasource insert() and delete() method  but updating  fails.i use try catch block to see the error but no errors found.And also update() method returns 1 that indicates that it worked fine but when i look into the database i see that the record is not updated.i am stucked and surprised.any ideas please?
Thanks
 

View 5 Replies View Related

Sqldatasource Update Problem

Apr 18, 2008

I just want to update a single file on the table with the content of a text box

the sql statement is update GAMME set newvaleur=@newvaleur where product_ID=old_product_ID

on sqldatasource1 updating I wrote

E.COMMAND.PARAMETERS("@newvaleur").value=....
e.command.parameters("old_product_id").value=....

the thing is it doesn't work, I don't think the line with the old_product_id is ok but I don't know how to do it...

View 4 Replies View Related

Help With UPDATE With SqlDataSource And A Repeater

Jan 15, 2006

Hi,
I have a repeater which i need to build editing capabilities into in a similar way as the GridView, just a little unsure how to tie it together.  Ideally i would like to use a GridView as this would do all of the work for me however it looks like I need to go with the repeater due to the nested nature of the data I am working with.
What is the best way to go about updating the data source from within a repeater?  I have already built the edit interface with some MultiViews in the Repeater control and handling the ItemCommand event, just not sure how to actually update the data source.
Can I still use the SqlDataSource wizard to generate all of the SQL for me?  If so, within the ItemCommand event handler I have the data i want to update back to the database by using the FindControl method and retrieving the Text, but how do i get this data into the SqlDataSource object and update the database?
Are there any samples available which show how to update a datasource using a repeater?
Your help is much appreciated
trenyboy

View 6 Replies View Related

Sql 2005 And Integration With Microsoft Update

Oct 16, 2006

I read that all versions of sql 2005 integrate with Microsoft Update. Is that true? (I don't recall ever seeing any sql 2005 updates -- but maybe I was using Windows Update not Microsoft Update?)

TIA,



Barkingdog

P.S. I know of two updates to sql 2005: SP1 and BOL but no others.






View 1 Replies View Related

SQLDataSource Update Using Parameters Not Working

Jul 10, 2006

I'm passing a parameter to a stored procedure stored on my sqlserver, or trying to atleast.  And then firing off the update command that contains that parameter from a button.  But it's not changing my data on my server when I do so.
I'm filling a dropdown list from a stored procedure and I have a little loop run another sp that grabs what the selected value should be in the dropdown list when the page loads/refreshes.  All this works fine, just not sp that should update my data when I hit the submit button.
It's supposed to update one of my tables to whatever the selected value is from my drop down list.  But it doesn't even change anything.  It just refreshes the page and goes back to the original value for my drop down list.
Just to make sure that it's my update command that's failing, I've even changed the back end data manually to a different value and on page load it shows the proper selected item that I changed the data to, etc.  It just won't change the data from the page when I try to.
 
This is what the stored procedure looks like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALTER PROCEDURE [dbo].[UPDATE_sp] (@SelectedID int) AS
BEGIN
UPDATE [Current_tbl]
SET ID = @SelectedID
WHERE PrimID = '1'
END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And here's my aspx page:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Editor.aspx.vb" Inherits="Editor" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Data Verification Editor</title>
</head>
<body>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SQLDS_Fill" runat="server" ConnectionString="<%$ ConnectionStrings:Test %>"
SelectCommand="Current_sp" SelectCommandType="StoredProcedure" DataSourceMode="DataSet">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SQLDS_Update" runat="server" ConnectionString="<%$ ConnectionStrings:Test %>"
SelectCommand="Validation_sp" SelectCommandType="StoredProcedure" DataSourceMode="DataReader"
UpdateCommand="UPDATE_sp" UpdateCommandType="StoredProcedure">
<UpdateParameters>
<asp:ControlParameter Name="SelectedID" ControlID="Ver_ddl" PropertyName="SelectedValue" Type="Int16" />
</UpdateParameters>
</asp:SqlDataSource>
<table style="width:320px; background-color:menu; border-right:menu thin ridge; border-top:menu thin ridge; border-left:menu thin ridge; border-bottom:menu thin ridge; left:3px; position:absolute; top:3px;">
<tr>
<td colspan="2" style="font-family:Tahoma; font-size:10pt;">
Please select one of the following:<br />
</td>
</tr>
<tr>
<td colspan="2">
<asp:DropDownList ID="Ver_ddl" runat="server" DataSourceID="SQLDS_Update" DataTextField="Title"
DataValueField="ID" style="width: 100%; height: 24px; background: gold">
</asp:DropDownList>
</td>
</tr>
<tr>
<td style="width:50%;">
<asp:Button ID="Submit_btn" runat="server" Text="Submit" Font-Bold="True"
Font-Size="8pt" Width="100%" />
</td>
<td style="width:50%;">
<asp:Button ID="Done_btn" runat="server" Text="Done" Font-Bold="True"
Font-Size="8pt" Width="100%" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label runat="server" ID="Saved_lbl" style="font-family:Tahoma; font-size:10pt;"></asp:Label>
</td>
</tr>
</table>
</form>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And here's my code behind:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Imports System.Data
Imports System.Data.SqlClient
Partial Class Editor
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Saved_lbl.Text = ""
Done_btn.Attributes.Add("OnClick", "window.location.href='Rpt.htm';return false;")
Dim View1 As New DataView
Dim args As New DataSourceSelectArguments
View1 = SQLDS_Fill.Select(args)
Dim Row As DataRow
For Each Row In View1.Table.Rows
Ver_ddl.SelectedValue = Row("ID")
Next Row
SQLDS_Fill.Dispose()
End Sub
Protected Sub Submit_btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit_btn.Click
SQLDS_Update.Update()
Saved_lbl.Text = "Thank you. Your changes have been saved."
SQLDS_Update.Dispose()
End Sub
End Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Any help is much appreciated.

View 4 Replies View Related

Can't Update A Record Using A DetailsView And SqlDataSource

Feb 13, 2007

Hi,I'm trying to create a registration page that I've divided into multiple pages (first page for basic details, next page for address, etc.). I insert the record in the first page, and update it in the other pages. I pass the newly created ID to the other pages using the Page.PreviousPage property.  In the second page, I have the SqlDataSource configured as "SELECT * FROM [Table] WHERE ID = ?", and the UpdateCommand is "UPDATE .... WHERE ID = ?".  In Page_Load, I am updating the SelectCommand to "SELECT ... WHERE ID = " & intID, and the UpdateCommand similarly. The I do a dtlsvw.Databind()But when I go to the next page (the newly created ID is being passed properly), the update doesn't do anything. The new record doesn't contain the values in the detailsview. Can somebody help me out? Thanks,Wild Thing 

View 2 Replies View Related

SQLDataSource: Update 2 Tables With 1 UpdateCommand?

Mar 16, 2007

I have a Gridview (edit enabled), connected to a SQLDataSource.
 SQLDataSource populates the gridview from 1 SelectCommand.
 figure1:
ColumnA | ColumnB | ColumnC
 
I have 2 SQL Server 2005 tables: Table1 and Table2 
Now on my SQLDataSource's UpdateCommand, I want the value of ColumnB to go to Table1's ColumnB, and ColumnC to go to Table2's ColumnC.
How do I do this?
I understand I can't do this with 1 UPDATE-SET sql query. Maybe I can with stored procs or something, but im kinda noobish when it comes to this. How? Thanks

View 1 Replies View Related

Error During SqlDataSource.Update() Instruction

May 29, 2007

Hi, I have such a problem:I try to update (or insert) a row in my table and i fail althought i,ve read many posts here. I.ve created a button and "on_click" event to this button and want that event to update or insert a record in my table. I wrote: protected void selectButton_Click(object sender, EventArgs e)    {        String taskID = projectsGridView.SelectedRow.Cells[0].Text;        usersSqlDataSource.UpdateCommand = "update [Users] set [TaskID]=@task where [UserID]=1";        usersSqlDataSource.UpdateParameters.Add("task", taskID);        usersSqlDataSource.Update();    }  The application creates error in the last line of code (usersSqlDataSource.Update();) and i receive such an error:You have specified that your update command compares all values on SqlDataSource 'usersSqlDataSource', but the dictionary passed in for oldValues is empty. Pass in a valid dictionary for update or change your mode to OverwriteChanges. For me it looks like there is a problem while setting parameters. Shall i change some properties of the sqlDataSource or GridView? Please help..    

View 2 Replies View Related

Help: Programmatically Update Data From An SQLDataSource (C#)

Jul 3, 2007

ello all
 Would someone be so kind as to save me from getting balder through pulling my hair out.
My aim is to extract data from a database using SQLDataSource, then edit the data and update the database using the SQLDataSource.
I have achieve the problem of retrieving the data from the sqlDataSource:DataView openRemindingSeats = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);        //Int32 openRemindingSeats = SqlDataSource2.Select(DataSourceSelectArguments.Empty), DataView;
        foreach (DataRowView rowProduct in openReminding)        {            //Output the name and price            lbl_NumOfSeatsLeft.Text = rowProduct["Remaining"].ToString();
        }
Within the sqlDataSource the sql code is as follows:SELECT [refNumber], [refRemaining] FROM [refFlights] WHERE ([refNumber] = @Number)
So at the moment my problems is being able to edit and update data to the same SELECTed data.Thank you for any help that you might have...
SynDrome

View 8 Replies View Related

SQLDataSource.Update Returning Negative Value

Jun 9, 2008

Does anyone know why would SQLDataSource.Update method return a negative value even though its updating records correctly?Its happening with .NET 2.0. 

View 2 Replies View Related

How To Put New Data Into SqlDataSource Update With Concatenated Key?

Jan 26, 2006

Here is the problem.
I have table such as this
PK selection VARCHARPK selection_choice VARCHAR      show BIT
When I use the sqlDataSource to create an update it creates this.UPDATE lu_selection_choices SET show = @show WHERE (selection = @selection) AND (selection_choice = @selection_choice)
Now this is OK, but when you perform an update and in say a details control you change the selection_choice the value of the parameter @selection_choice is going to be equal to the old data.  So it performs a successful update on show which isn't being changed selection_choice is.
So the questions is.  Is there anyway to tell the update function of the datasource to insert the a new parameter with the SET selection_choice = @SOME NEW PARAM slection_choice?
Thanks,
Darren King
 

View 4 Replies View Related

How To Trigger The Update Command Of The SQLDataSource

Jun 13, 2006

Hi - I'm using .net2, and have a gridview, populated by a SQL Datasource (Edit, Insert, Delete, Select).
Like we all used to do with the datagrid, I've added text boxes into the footer, and a link button, which I'd like to use to fire the Update command.
How do I get the link button to trigger the update command?
Thanks, Mark

View 1 Replies View Related

Is Microsoft Going To Include KB940287 In A Cumulative Update?

Nov 15, 2007

Re: KB 940287 - Will it be in a Cumulative Update?
SYMPTOMS:


You use Service Broker in SQL Server 2005. When the initiating service starts a conversation and then sends a message, the initiating service ends the conversation immediately. However, after the target service processes the message, the endpoint on the target server is not deleted when the target service ends the conversation. Therefore, when the initiating service starts a new conversation, the number of the conversation endpoints on the target server keeps increasing.

Additionally, you receive the following error message on the initiator server:

An error occurred while receiving data: '64(The specified network name is no longer available.)'
This message could not be delivered because the conversation endpoint has already been closed.



It has several workarounds. I've not been affected by this yet, but KB says it has a hotfix that has been out since July 2007, so it is curious that it has not been put into a Cumulative Update yet, at least as far as documentation in Knowledge Base is concerned. Does anyone know any more about this?

Paul

View 1 Replies View Related







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