Updating A SqlDataSource
Dec 12, 2006
I am looking for a way to update a sqldatasource what I have is a ASP Wizard application
step one
is a dataview with the select ability it displays an ID and Name
in step two what i want it to do is take the ID from step ones select and put that into the where clause so I have select * from table where id = step1selectedID
Code:
View 1 Replies
ADVERTISEMENT
Apr 27, 2006
When I bind a GridView to a SQLDataSource where are the update parameter values set. What event will allow me to see the paramter values. I am trying to understand a little better how things work under the covers.
Jay
View 2 Replies
View Related
Oct 6, 2006
Hello, I just started working with ASP.NET.I'm trying to use the CheckBoxList Control. As I understand it, you can bind a SqlDataSource to this control and it loads the list for you. However tp precheck the items, you have to do this manually. This part works fine. Next part was to save whatever the user checks. I wrote stored Procedure and now just trying to pass 1 parameter to the stored procedure using a second SqlDataSource. I get the error: "A severe error occurred on the current command. The results, if any, should be discarded."Here is the second datasource I am using to try and save the data:<asp:SqlDataSource ID="sds_PersonRole" runat="server" ConnectionString="<%$ ConnectionStrings:Development %>"SelectCommand="usp_selectPersonRole"SelectCommandType="StoredProcedure"UpdateCommand="usp_updatePersonRole"UpdateCommandType="StoredProcedure"><SelectParameters> <asp:ControlParameter ControlID="gv_Person" Name="PERSON_ID" PropertyName="SelectedValue" Type="Int32" /></SelectParameters><UpdateParameters> <asp:Parameter Name="strXML" Size="8000" Type="String" /> <asp:Parameter Direction="InputOutput" Name="err_msg" Type="String" Size="150" DefaultValue="0" /></UpdateParameters></asp:SqlDataSource>I have a code behind file with the following modules: (btnEditPerson is clicked to start the process. the sds_PersonDetails is updated via form contolls and works fine.) Error occurs on the bolded line (Stored procedure is just accepting the string and saving to a field. It works fine, I tested it. Its just erroring out before it runs the stored procedure. Protected Sub btnEditPerson_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEditPerson.Click sds_PersonDetails.Update() gv_Person.DataBind() sds_PersonRole.Update()End Sub Protected Sub sds_PersonRole_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles sds_PersonRole.Updating Dim command As Data.Common.DbCommand command = e.Command 'un-check all checkboxlist items (count - 1 to account for starting at 0) Dim listCount As Integer = cbl_Role.Items.Count() - 1 Dim strXML As String strXML = "<personRole>" For x As Integer = 0 To listCount If cbl_Role.Items(x).Selected() = False Then strXML = strXML & "<person id='" & gv_Person.SelectedValue & "' />" strXML = strXML & "<role id='" & cbl_Role.Items(x).Value & "' />" End If Next strXML = strXML & "</personRole>" command.Parameters("@strXML").Value = strXML lbl_ErrMsg.Text = command.Parameters("@err_msg").Value.ToString() End Sub
View 1 Replies
View Related
Mar 6, 2007
I am updating data with sqlDatasource but it is inserting NULL, tell what I am missing <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1"
DefaultMode="Insert" Width="100%">
<InsertItemTemplate>
<table width="100%">
<tr>
<td style="width: 100px">
Name</td>
<td style="width: 100px">
<asp:TextBox ID="txtCategory" runat="server" Text='<%# Eval("CategoryName") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
Parent</td>
<td style="width: 100px">
<asp:DropDownList ID="ddlParent" runat="server" DataSourceID="SqlDataSource1" DataTextField="CategoryName" DataValueField="CategoryID" Width="100%">
</asp:DropDownList></td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px">
<asp:Button ID="btnAdd" runat="server" Text="Add" CommandName="Insert"/></td>
</tr>
</table>
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CommerceTemplate %>"
SelectCommand="SELECT [CategoryID], [CategoryName], [CategoryMID] FROM [CMRC_Categories]"
DeleteCommand="DELETE FROM [CMRC_Categories] WHERE [CategoryID] = @CategoryID"
InsertCommand="INSERT INTO [CMRC_Categories] ([CategoryName], [CategoryMID]) VALUES (@CategoryName, @CategoryMID)"
UpdateCommand="UPDATE [CMRC_Categories] SET [CategoryName] = @CategoryName, [CategoryMID] = @CategoryMID WHERE [CategoryID] = @CategoryID">
<DeleteParameters>
<asp:Parameter Name="CategoryID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CategoryName" Type="String" />
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="CategoryMID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:FormParameter Name="CategoryName" Type="String" FormField="txtCategory" />
<asp:FormParameter Name="CategoryMID" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource> Please suggest cheers
View 4 Replies
View Related
May 29, 2007
I have such a problem:i try to update a row in my table using: 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(); }And i receive error on usersSqlDataSource.Update():You have specified that your update command compares all values on SqlDataSource 'usersSqlDataSource', but the dictionary passed in for oldValues is emptyWhat have i done wrong? Parameter are not set?
View 3 Replies
View Related
Nov 19, 2007
I am experiencing some wacky errors here. While trying to update a field that does not allow nulls and the default value is set to '', I keep receiving an exception error that:
Cannot insert the value NULL into column 'image_name', table 'DB_123871.dbo.tWebBlogs'; column does not allow nulls. UPDATE fails. The statement has been terminated.
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="SqlGetBlogs" DataKeyNames="article_id" AutoGenerateColumns="False" CssClass="GridView" CellPadding="4" HorizontalAlign="Center" Width="875px">
<Columns>
<asp:CommandField CancelImageUrl="~/images/Cancel.gif" EditImageUrl="~/images/Edit.gif"
UpdateImageUrl="~/images/Update.gif" ButtonType="Image" HeaderText="Edit" ShowEditButton="True">
</asp:CommandField>
<asp:BoundField DataField="article_id" HeaderText="ID" ReadOnly="True" />
<asp:TemplateField HeaderText="Artilce Header">
<EditItemTemplate>
<asp:TextBox ID="ArticleHeaderTxt" runat="server" Text='<%# Bind("article_header") %>' Width="250"></asp:TextBox>
<asp:RequiredFieldValidator ID="ArticleHeaderTxtReq" runat="server" ControlToValidate="ArticleHeaderTxt" Display="Dynamic" EnableClientScript="true" ErrorMessage="Article Header Required" SetFocusOnError="true"></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="ArticleHeaderLbl" runat="server" Text='<%# Eval("article_header") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Article Description">
<EditItemTemplate>
<asp:TextBox ID="ArticleDescriptionTxt" runat="server" Text='<%# Bind("article_description") %>' Width="325" Rows="8" TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="ArticleDescTxtReq" runat="server" ControlToValidate="ArticleDescriptionTxt" Display="Dynamic" EnableClientScript="true" ErrorMessage="Article Description Required" SetFocusOnError="true"></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="ArticleDescriptionLbl" runat="server" Text='<%# Eval("article_description") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Link Short Text">
<EditItemTemplate>
<asp:TextBox ID="ArticleLinkTxt" runat="server" Text='<%# Bind("short_link_text") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="ArticleLinkTxtReq" runat="server" ControlToValidate="ArticleLinkTxt" Display="Dynamic" EnableClientScript="true" ErrorMessage="Article Link Text Required" SetFocusOnError="true"></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="ArticleLinkLbl" runat="server" Text='<%# Eval("short_link_text") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Article Link">
<EditItemTemplate>
<asp:TextBox ID="ArticleLink" runat="server" Text='<%# Bind("article_link") %>' Width="250"></asp:TextBox>
<asp:RequiredFieldValidator ID="ArticleLinkReq" runat="server" ControlToValidate="ArticleLink" Display="Dynamic" EnableClientScript="true" ErrorMessage="Article Link URL Required" SetFocusOnError="true"></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:HyperLink ID="ArticleLinkLnk" runat="server" CssClass="LinkNormal" NavigateUrl='<%# Eval("article_link") %>'
Target="_blank" Text="View Link"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image Name">
<EditItemTemplate>
<asp:TextBox ID="Image1Txt" runat="server" Text='<%# Bind("image_name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1Img" runat="server" AlternateText='<%# Eval("image_name") %>' ImageUrl='<%# Eval("image_name", "~/Blogs/Images/Thumbs/{0}") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date Entered">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("article_date_entered", "{0:d}") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("article_date_entered", "{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Active?">
<EditItemTemplate>
<asp:CheckBox ID="ActiveChk" runat="server" Checked='<%# Bind("active") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="ActiveChk" runat="server" Checked='<%# Eval("active") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete?">
<ItemTemplate>
<asp:ImageButton ID="DeleteBtn" runat="server" AlternateText="Delete Record" CommandName="Delete"
ImageUrl="~/images/Delete.gif" OnClientClick="return confirm('Are you sure you want to delete this blog?');" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle HorizontalAlign="Left"></RowStyle>
<EditRowStyle Font-Bold="False"></EditRowStyle>
<HeaderStyle CssClass="GridViewHeader" HorizontalAlign="Left"></HeaderStyle>
<AlternatingRowStyle CssClass="GridViewAltRow"></AlternatingRowStyle>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<div style="text-align: center;"><asp:Label ID="recordset_lbl" runat="server" CssClass="HelpTextNormal"></asp:Label></div>
</td>
</tr>
</table>
</div>
<asp:SqlDataSource ID="SqlGetBlogs" runat="server" ConnectionString="<%$ connectionStrings:dbconn1 %>"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT article_id, article_header, article_description, image_name, short_link_text, article_link, article_date_entered, active FROM tWebBlogs ORDER BY article_date_entered DESC"
SelectCommandType="Text"
UpdateCommand="UPDATE tWebBlogs SET article_header=@article_header, article_description=@article_description, image_name=@image_name, short_link_text=@short_link_text, article_link=@article_link, active=@active WHERE article_id=@article_id"
UpdateCommandType="Text"
DeleteCommandType="Text"
DeleteCommand="DELETE tWebBlogs WHERE article_id=@article_id">
<DeleteParameters>
<asp:Parameter Name="article_id" />
</DeleteParameters>
</asp:SqlDataSource>
Please help! I am stumped!
View 1 Replies
View Related
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
Apr 3, 2008
hello.i'm having the following problem.in one page i have a dataset created at runtime along side with sqldataadapter and an sqlconnection.i'm using a dataset here since i'm working with heirarchical tables.when i click on child table [in a spcific column] it opens up a new aspx page with an editing form [formview in edit mode]when
i press the update button it claims to update the data, but when i
close the form and reopen it from the same column it opens the form
again, but with the old data, and the new data doesn't get updated
until i close the openinig aspx page [the one with the table]
refreshing it doesn't work, nor does creating a postback.anyone has any ideas ?
View 2 Replies
View Related
Sep 21, 2006
I am very new to SQL Server 2005. I have created a package to load data from a flat delimited file to a database table. The initial load has worked. However, in the future, I will have flat files used to update the table. Some of the records will need to be inserted and some will need to update existing rows. I am trying to do this from SSIS. However, I am very lost as to how to do this.
Any suggestions?
View 7 Replies
View Related
Jul 23, 2007
What is the C# code I use to do this?
I'm guessing it should be fairly simple, as there is only one row selected. I just need to pull out a specific field from that row and then insert that value into a different SqlDataSource.
View 7 Replies
View Related
Mar 8, 2007
i am using visual web developer 2005 with SQL Express 2005 with VB as the code behindi have one database and three tables in itfor manipulating each table i am using separate SqlDataSource() is it sufficient to use one SqlDataSource() for manipulating all the three tables ? i am manipulating all the tables in the same page only please help me
View 1 Replies
View Related
Aug 24, 2007
I am trying to make a stored procedure in my website for updating an address:1 CREATE PROCEDURE dbo.UPDATE
2 (
3 @add NVarchar(50),
4 @cit NVarchar(50),
5 @state NVarchar(50),
6 @zip NVarchar(50),
7 @CNum int
8 )
9
10 UPDATE table_name
11 AppAdd = @add, AppCity = @cit, AppState = @state, AppZip = @zip
12 WHERE CertNum = @CNum When I try to save it it give me an error: Incorrect syntax near keyword 'UPDATE'Must declare scalar variable '@add'
View 1 Replies
View Related
Feb 24, 2008
Hi, I'm new to ASP.Net quite new to C# (My first attempt at a database website) and am trying to get a button to add "1" to "int" value called "Comments" a each time its pressed basically counting each time a comment is added. I also only wnat it to affect the row where "ModID" in my database is equal to the query string "ModID" I'm using on the page. I cannot find any tutorials so this is my best guess so far. This is probably a Noobie type stupid question but I'm stuck. This is the code I have so far for my Button_Click event: protected void Button_Click(object sender, EventArgs e){ SqlDataSource CommentCountDataSource = new SqlDataSource(); CommentCountDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["Main_Site_DatabaseConnectionString1"].ToString(); CommentCountDataSource.UpdateCommandType = SqlDataSourceCommandType.Text; CommentCountDataSource.SelectCommand = "SELECT (ModID, DateTimeLastComment, Comments) FROM Mods"; CommentCountDataSource.UpdateCommand = "UPDATE Mods SET (DateTimeLastComment=@DateTimeLastComment, Comments=@Comments) WHERE ModID=@ModID"; //How do i get the Where to use the query string info? CommentCountDataSource.UpdateParameters.Add("DateTimeLastComment", DateTime.Now.ToString()); CommentCountDataSource.UpdateParameters.Add("Comments", "10"); //"10" is just a value to test I'll change this to add "1" once I figure how. CommentCountDataSource.Update();} Sorry if I'm using the wrong lingo but as I say I'm new. If my code is a mile off then please can you send me in the right direction of some code that works.Thanks in advance if anyone can help me. Cheers,Alan
View 5 Replies
View Related
Apr 13, 2008
guys can anyone know whats wrong with my syntax? I always get this error: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.This is the syntax: Protected Sub btnupd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnupd.Click Dim pwing, pblood, pcolor, plcolor, pmark, pbdate, pstat, premark, ppefr, pstyle As Object Dim sql As String Dim y As New Object y = GVh.SelectedDataKey(0) pwing = txtwingb.Text pblood = txtblood.Text pcolor = txtcolor.Text plcolor = txtlcolor.Text pmark = txtmark.Text pbdate = ddday.SelectedValue & "-" & Ddmonth.SelectedValue & "-" & ddyear.SelectedValue pstat = txtstat.Text premark = txtremark.Text sql = "UPDATE [broodhen]" sql = sql & " SET bwing = '" & pwing & "'," sql = sql & " bloodlines = '" & pblood & "'," sql = sql & " color = '" & pcolor & "'," sql = sql & " lcolor = '" & plcolor & "'," sql = sql & " mark = '" & pmark & "'," sql = sql & " bday = '" & pbdate & "'," sql = sql & " status = '" & pstat & "'," sql = sql & " remarks = '" & premark & "'" sql = sql & " WHERE(bwing = '@wwing')" DShen.UpdateCommand = sql DShen.Update() MView.SetActiveView(GView) End SubThat is from my aspx.vb file and for the .aspx my datasource:<asp:SqlDataSource ID="DShen" runat="server" ConnectionString="<%$ ConnectionStrings:CSD %>" ProviderName="<%$ ConnectionStrings:CSD.ProviderName %>" SelectCommand="SELECT * FROM [broodhen]" > </asp:SqlDataSource> Note: I select records from a gridview to edit. i can delete, insert, select but i cant update. please help... tnx.
View 3 Replies
View Related
Jul 28, 2005
I am trying to update a SQL Server DB via my ASP.NET application with the following SqlCommand:
UPDATE StudentCourses
SET SC_Active = 0
WHERE (UT_ID IN (@UT_IDs)) AND (CO_ID = @CO_ID)
@UT_IDs in populated from a StringBuilder object with the following:
354,284,305,281,308,351,439,355,306,282
When I run the application to update the DB, I get the error:
System.FormatException: Input string was not in a correct format.
If I change @UT_IDs to:
354
if works.
Can anyone explain this behaviour?
Cheers,
ocann
View 1 Replies
View Related
Feb 8, 2001
I am a DBA who is moving in the direction of minor database design. I have gone through the steps to get my tables normalized, and I am ready to get them set up so they will update from table to table. How do I set this up? I know SQL does not cascade like Access, so how is this done? From what I have read (Robert Vieira's book) I should use triggers? Any help would be appreciated. Dallas
View 1 Replies
View Related
Aug 30, 2005
I have a query that updates
strSQL = "UPDATE customers SET "
strSQL &= "entryid = '" & strtheEntryid & " ' "
strSQL &= "WHERE id =1 "
right now in table id is my primary key field it increments by 1, I want to say get first record instead of saying id = 1, how to do that?
View 2 Replies
View Related
Nov 29, 2007
I have some code to hack in c#..
I have a database and when a form (C#) is loaded a copy of the table is made in a DataTable object. The form has a list box showing just the one column of info from the local DataTable.
On the form it is possible to change a record, delete a record and add a record. These are all done in the local table.
The question, how do i send these changes back to the database. Currently it deletes the lot and copies all the local table values in. How do only do the affected row, UPDATE, INSERT etc
View 1 Replies
View Related
Mar 25, 2008
Hey
I have an ASP application that uses a stored procedure and ADO.net to update a sql server data file. The problem is I know the code is working, I don't have any errors with the ADO, no exceptions are caught. I can use the same basic code to insert a record using a different procedure. It is the update procedure that does not carry through.
So, I know I have a connection, the procedure works using the query builder directly so the procedure works, but when I run the code, I get no errors and no update to the datafile. I am not even sure how to trouble shoot this since I don't have an error to look up.
C# Code:-------------
private void UpdateIssue()
{
DateTime date = new DateTime();
date = Convert.ToDateTime(this.txtDate.Text);
//edit record in HelpDeskIssuesTbl here.
SqlConnection con = new SqlConnection("Data Source...");
SqlCommand comUpdateTicket = new SqlCommand("sp_UpdateHelpDeskIssues", con);
comUpdateTicket.CommandType = CommandType.StoredProcedure;
comUpdateTicket.Parameters.Add("@IssueID", this.GridView1.SelectedIndex.ToString());
comUpdateTicket.Parameters.Add("@EmpID", this.ddlEmployee.SelectedValue.ToString());
comUpdateTicket.Parameters.Add("@Date", date.ToShortDateString());
comUpdateTicket.Parameters.Add("@StatusID", this.ddlStatus.SelectedValue.ToString());
try
{
con.Open();
comUpdateTicket.ExecuteNonQuery();
}
catch (Exception ex)
{
this.lblMessage.Text = "Data save error: " + ex.Message.ToString();
this.pnlMessage.Visible = true;
}
finally
{
con.Close();
}
}
----------------------------------------------------
dbo.sp_UpdateHelpDeskIssues
(
@IssueID int,
@EmpID int,
@Date datetime,
@StatusID int
)
AS
UPDATE HelpDeskIssuesTbl
SET EmployeeID = @EmpID, IssueDate = @Date, IssueStatusID = @StatusID
WHERE (IssueID = @IssueID)
RETURN
Like I said the Stored Procedure does work when I run it directly in Visual Studio. I have double checked all the params and they all match up unless I am missing something.
Please send help! Thanks.
View 2 Replies
View Related
Jul 17, 2007
Hi gurus,
My feeling with the SCD component is not that very solid. I have the feeling that the behavior of the insert/update strategy is not always correct an working.
I will describe two problems that i encounter.
1. My destination table contains records with the value ''. Cause i don't want '' ( 2 single quotes) in our DWH i update the view that is the source with a case statement that changes the '' to NULL. But when i run the packages the '' values are not update with the NULL values. When i delete the destination table and run the package, the records are inserted with the NULL value as expected. Anyone who has experienced this problem?
2. When i create a new table and run the package so the destination table gets filled with records the SCD will insert alle records (for example 100). When i start the run directly after the first run, all records are updated instead of doing nothing what it should do cause all records exists.
Anyone who can give me some feedback?
with regards, Arthur
View 15 Replies
View Related
Jun 27, 2006
Hi
I come from a Unix backgound and used Informix ISQL quite frequently.
I have a row that contains a compund field 'cust_and_date' and contains a value of C0003 32656
I want to write an update statement that will amend the C0003 to C00009 but leaves the 32656 as is.
I tried the following:-
update scheme.slitemm set substring(cust_and_date,1,8) = 'C00009'
This returned a syntax error
Any help gratefully received
View 5 Replies
View Related
Aug 20, 2006
I have an asp:sqldatasource which is bound to a gridviewIn addition to this I would like it to a) see if there is a specif row/ item in it (ie item_id = 10 for any of the rows it has received) as I conditionally want to show another item outside of the gridview subject to if it is in the gridview or notb) show the sum of all the values within a certain column of returned rowsMany thanks
View 1 Replies
View Related
Oct 11, 2006
How do I get the result of this select into a variableDim sqldsFindUserId As SqlDataSource = New SqlDataSource sqldsFindUserId.ConnectionString = ConfigurationManager.ConnectionStrings("bluConnectionString2").ToString sqldsFindUserId.SelectCommandType = SqlDataSourceCommandType.Text Dim myUserIdCmd As String = "select pkUser from tblUsers where strDisplayName='" + myDisplayname + "" sqldsFindUserId.SelectCommand = myUserIdCmd ' The result of this select statement is to be stored in a variable, how do I do it?
View 2 Replies
View Related
Jan 15, 2007
hi all,
in all my 2.0 learnings and books i keep coming across the page element <asp:sqldatasource>.
I have always (in 1.1) used server side connections and adapters to bind my Sql datasets to any control needed. Now that im learning 2.0 im finding it difficult to understand using control on the page to bind my data. Can someone explain the benefits of using this data source? Ideally i would like to keep my data access layer separate from my presentation layer but i'd really like to understand why this method seems so popular.
thanks in advance,
mcm
View 2 Replies
View Related
Feb 23, 2007
Hi, I am new to ASP.NET 2.0 and I am trying to use VWB to bind my web site to a SQL Express edition. I used SQLDataSource to specify the .mdf file so I can connect to my tables but when I click on the advanced button to generate the Insert, Update, Delete SQL I find it grayed out and it cannot be clicked. I looked into several tutorials online and I couldn't find the problem, can anyone explain what I am missing or doing wrong? Any suggestion is very appreciated. Thanks
View 2 Replies
View Related
Mar 30, 2007
SELECT * FROM [CONTACTS] WHERE @ddl_value LIKE '%@txt_value%'
Why doesn't this not working
I am using SQLdatasource control to bind a gridview
If my query is wrong then what might be the correct one to work with like operator in the sqldatasource
Can any ony help me!
View 4 Replies
View Related
Apr 12, 2007
Hello All,
I have quick question ..
In my aspx page i have gridview and Sql DataSource object as you can see
<asp:sqldatasource id="SqlDataSource1" runat="server" ></asp:sqldatasource>
<asp:gridview id="GridView1" runat="server" allowpaging="True" allowsorting="True" autogeneratecolumns="False" datasourceid="SqlDataSource1">
<columns>
<asp:boundfield datafield="breakdownid" headertext="breakdownid" insertvisible="False"
readonly="True" sortexpression="breakdownid" />
<asp:boundfield datafield="ticketno" headertext="ticketno" sortexpression="ticketno" />
<asp:boundfield datafield="systemtype" headertext="systemtype" sortexpression="systemtype" />
<asp:boundfield datafield="break_date" headertext="break_date" readonly="True" sortexpression="break_date" />
<asp:boundfield datafield="subject" headertext="subject" sortexpression="subject" />
<asp:boundfield datafield="status" headertext="status" sortexpression="status" />
<asp:boundfield datafield="prioritylevel" headertext="prioritylevel" sortexpression="prioritylevel" />
<asp:boundfield datafield="mobiletype" headertext="mobiletype" sortexpression="mobiletype" />
</columns>
</asp:gridview>
In codebehind file i call a function to get data from database. what i want is to bind the result to the sqlDataSourse not the gridview.
I need to have the SqlDataSourse thier.. Any help please
Sub Page_load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim objReader As New Dynamic.Reportsdemo
SqlDataSource1 = .objReader.Get_Tickets(1, 0, "all")
SqlDataSource1.DataBind()
objReader.objconnection.Close()
End If
End Sub
Thanks.
View 1 Replies
View Related
May 28, 2007
Hi!Please tell me, how to get a simple value using SQLDataSource, I mean a number, or char, or string - any value, NOT DataTable
View 3 Replies
View Related
Jul 23, 2007
I am trying to get record from a table and verify it with a textbox i have a sqldatasource.
i have a text box called txtEmail and this is my Select command. how can i get this working if its possible ?
something like txtEmail.text = SqlDataSource1.Secect then ... my code. (i dont know if this a correct way to do this)
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:imacstestConnectionString %>"
SelectCommand="SELECT FROM [t_CustomerAcct]"
thanks,
View 1 Replies
View Related
Aug 13, 2007
hi all,i am using sqldatasource for gridviewso that i can edit and update any row at the same place ..... and not to write any code for that....now later on if i wanna change the selectcommand of that sqldatasource how can i ? so that the edit and update will be same as it was....
View 2 Replies
View Related
Aug 21, 2007
Hi,
I'm trying to go through a checkbox list and inserting them into a database using a sqldatasource with the following code:For Each li As ListItem In Locations_Checkbox.Items
If li.Selected = True Then
Dim DataSource2 As SqlDataSource = CType(InsertProgrammeLocations, SqlDataSource) DataSource2.InsertParameters.Add("ProgrammeID", li.Value)
DataSource2.Insert()
End If
Next
When more than one checkbox is ticked, I'm getting the error 'The variable name '@ProgrammeID' has already been declared'. How do I close or reset my Datasource before I try and use it again?
Thanks for your help
View 3 Replies
View Related
Oct 28, 2007
please explain selectparameter collection and conflict detection property and filterparameter
mohsen
View 1 Replies
View Related