Search Results

Search found 116 results on 5 pages for 'sqldatasource'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • Select parameter not working on SqlDataSource.

    - by ProfK
    I am using the stored procedure below for the select command of a SqlDataSource, and I'm trying to pass a query string parameter, but I get this error: Procedure or function 'ActivationCampaignGetById' expects parameter '@campaignId', which was not supplied. The parameter is present in the query string: http://localhost:62681/Activations/ActivationCampaignDetails.aspx?id=98 Here is my DataSource code: <asp:SqlDataSource ID="campaignDataSource" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ProVantageMediaManagement %>" SelectCommand="ActivationCampaignGetById" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:QueryStringParameter DefaultValue="98" Name="campaignId" QueryStringField="id" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> And my stored procedure declaration: ALTER procedure [dbo].[ActivationCampaignGetById] @campaignId int as select

    Read the article

  • syntax in sqldatasource selectcommand

    - by netNewbi3
    Hi, My SqlDataSource selectcommand is dynamically changed by the String.Format functionality of the Eval one-way databinding syntax. It works ok. However I need to put together two columns values with a space in the middle (ItemType + '" "' + ItemDescription As ItemInfo) but I can't get the syntax correct as I get the message: "The server tag is not well formed" Can you help? Many thanks <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:conn %>" SelectCommand='<%# Eval("TypeID", "SELECT ItemID, ItemType, ItemType + '" "' + ItemDescription As ItemInfo WHERE ItemType = {0}")%>'> </asp:SqlDataSource>

    Read the article

  • asp:SqlDataSource binded to asp:DropDownList

    - by _simon_
    I have a asp:SqlDataSource and asp:DropDownList components on my page. On normal page it works ok. Now I'd like to put this on new page with url like ...mypage.aspx?transactionID=2. In Page_Load I would like to set Transaction drop down selected index to 2. But it always binds to 1. I assume, that things happen in this order: in Page_Load I set selected index to 2. Then asp:SqlDataSource's select statement executes and binds to DropDownList. That's why selected index of my DropDownList is always 1, no matter what I set it in Page_Load. So, how can I bind asp:SqlDataSource to asp:DropDownList and also set it's selected index parameter to some integer?

    Read the article

  • Reading Values Returned by SQLDataSource Before Binding to FormView

    - by peter.newhook
    I have a FormView that shows posts by users. I'd like to add Edit and Delete commands to the post to let the original author edit or delete their post. I'd like these commands to be available to only the author. The FormView is populated by a SqlDataSource that uses a stored procedure. I was thinking I would set the Edit and Delete hyperlink to Visible=False, then compare the currently signed in user guid to the guid of the post's author, and make the hyperlinks visible if the two guids are the same. I've tried using the Selected event of the SqlDataSource to capture the guid (which is returned by the stored procedure) however I can't find way to get the values returned by this datasource. How do I access the values returned by a SqlDataSource before they get databound?

    Read the article

  • How to use SqlDataSource for filling combobox as well as datatable or Dataset

    - by Shantanu Gupta
    I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="CityName_OnTextChanged"> </asp:DropDownList> <asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" SelectCommand="SELECT * FROM [vcity]" ></asp:SqlDataSource> Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource. I have four columns in datasource i.e. name, id, address, phno. I want to fetch an address of a person who selects some value from ddl.

    Read the article

  • SQLDatasource CommandTimeout not working

    - by Cedric Aube
    Good day, I'm using a SQLDataSource with a dynamic query generated c#, based on user choices in many fields. However, since our tables are very large, sometimes, I get a command timeout exception. I tried to set the property in 'Selecting' of the SqlDataSource like so: protected void SqlDataSource_PSearch_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { e.Command.CommandTimeout = 900; } but with not luck, like if this attribute was ignored. .NET 2.0, Sql server 2005. Any idea?

    Read the article

  • ASP.NET error when trying to configure ListView + SqlDatasource for a MySql Table

    - by stighy
    Hi, i'm using ASP.NET + a MySql Db. I'm trying to configure a ListView so i've written: <asp:SqlDataSource ID="dsDatiUtente" runat="server" ConnectionString="Server=12.28.136.29;Database=mydb;Uid=m111d1;Pwd=fake;Pooling=false;" ProviderName="MySql.Data.MySqlClient" SelectCommand="SELECT * FROM user WHERE idUser=@IdUser" / At the beginning of my aspx page i've added <%@ Import Namespace="MySql.Data.MySqlClient" %> But if i click to the sqldatasource and click "Refresh Schema" i got this error: "Unable to retrive schema.... Unable to find the requested .Net Framework data provider" For instance, i've installed it , but i've also uninstalled old version, then installed new versions. In my project i simple copy Mysql dll into "bin" folder, then add a reference to that dll. I'm not sure is the corrected way... I need to have the "refreshed schema" to permit vs.net to build automatically my listview ... if i can't to "auto build" listview, i have to write all code by hand, and it is a too expensive work me :( What i'm wrong ? Thank you!

    Read the article

  • Change Label Control Property Based on Data from SqlDataSource Inside a Repeater

    - by Furqan Muhammad Khan
    I am using a repeater control to populate data from SqlDataSource into my custom designed display-box. <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnDataBinding="Repeater_ItemDataBound"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <div class="bubble-content"> <div style="float: left;"> <h2 class="bubble-content-title"><%# Eval("CommentTitle") %></h2> </div> <div style="text-align: right;"> <asp:Label ID="lbl_category" runat="server" Text=""><%# Eval("CommentType") %> </asp:Label> </div> <div style="float: left;"> <p><%# Eval("CommentContent") %></p> </div> </div> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater> <asp:SqlDataSource ID="mySqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" SelectCommand="SELECT [CommentTitle],[CommentType],[CommentContent] FROM [Comments] WHERE ([PostId] = @PostId)"> <SelectParameters> <asp:QueryStringParameter Name="PostId" QueryStringField="id" Type="String" /> </SelectParameters> </asp:SqlDataSource> Now, there can be three types of "CommentTypes" in the database. I want to change the CssClass property of "lbl_category" based on the value of [CommentType]. I tried doing this: <asp:Label ID="lbl_category" runat="server" CssClass="<%# Eval("CommentType") %>" Text=""><%# Eval("CommentType") %></asp:Label> But this gives an error: "The server control is not well formed" and haven't been able to find a way to achieve this in the code behind. Can someone please help?

    Read the article

  • Updating asp:SqlDataSource Parameter via asp:LinkButton

    - by Mattec
    I'll try to explain what I'm doing the best I can, but I'm pretty new to asp.net so be patient with me. I have a SqlDataSource which returns a simple select statement based on the WHERE clause using @COURSE_ID What I want to-do is every time any one of 2 (this will change as it's going to be generated) asp:LinkButtons are pressed, they will change the @COURSEID value which i'd like to associate with the specific button. Buttons: <asp:LinkButton ID="LinkButton2" runat="server" onclick="MenuUpdate_Click">Course1</asp:LinkButton> <asp:LinkButton ID="LinkButton1" runat="server" onclick="MenuUpdate_Click">Course2</asp:LinkButton> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connString %>" SelectCommand="SELECT Chapter.chapterName, Chapter.chapterID FROM Chapter WHERE Chapter.courseID = @COURSE_ID " C# protected void MenuUpdate_Click(object sender, EventArgs e) { Parameter p = SqlDataSource1.SelectParameters["COURSE_ID"]; SqlDataSource1.SelectParameters.Remove(p); SqlDataSource1.SelectParameters.Add("COURSE_ID", THIS NEEDS TO BE VALUE ASSOCIATED TO BUTTON); ListView1.DataBind(); UpdatePanel1.Update(); } If anyone has any suggestions that'd be great, I've been trying lots of different things all night with no success :( Thanks

    Read the article

  • ASP.NET SqlDataSource update and create FK reference

    - by William
    The short version: I have a grid view bound to a data source which has a SelectCommand with a left join in it because the FK can be null. On Update I want to create a record in the FK table if the FK is null and then update the parent table with the new records ID. Is this possible to do with just SqlDataSources? The detailed version: I have two tables: Company and Address. The column Company.AddressId can be null. On my ascx page I am using a SqlDataSource to select a left join of company and address and a GridView to display the results. By having my UpdateCommand and DeleteCommand of the SqlDataSource execute two statements separated by a semi-colon I am able to use the GridView's Edit and Delete functionality to update both table simultaneously. The problem I have is when the Company.AddressId is null. What I need to have happen is have the data source create a record in the Address table and then update the Company table with the new Address.ID then proceed with the update as usual. I would like to do this with just data sources if possible for consistency/simplicity sake. Is it possible to have my data source do this, or perhaps add a second data source to the page to handle some of this? Once I have that working I can probably figure out how to make it work with the InsertCommand as well but if you are on a roll and have an answer for how to make that fly as well feel free to provide it. Thanks.

    Read the article

  • How to Pass parameter to SQlDataSource from gridview?

    - by user144842
    Gridview has many columns and a Delete button as well. Delete button is a control as TemplateField <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="btnDelete" CommandName="Delete" Text='<%# Eval("disabled").ToString()=="False" ? "Disabled" : "Enabled" %>' OnClientClick="return confirm('Are you sure you want to take this action?');" runat="server"></asp:LinkButton> </ItemTemplate> </asp:TemplateField> Now associated SQLDataSource's Delete command's stored procedure is expecting two parameters. One is going from DataKeyNames (RowID), other one i wanna pass is the Text of btnDelete (True or False). How can i achieve it?

    Read the article

  • Running a stored procedure in a SqlDataSource on button click

    - by Gapton
    I am building a C# ASP.NET page where I want to call a stored procedure in a database. I have setup a SqlDataSource which points to the stored procedure. Parameters are obtained from the Web's control directly (TextBox) I have a button, when the user clicks it it should run the stored procedure, so I was going to add code like this : mySqlDataSource.run() or mySqlDataSource.exec() or mySqlDataSource.storedProcedure() but of course none of these methods exist. How do I initial the stored procedure? and how do I get the value returned by the stored procedure please? Thank you!

    Read the article

  • Please help, looking for any answer for long time :How to use SqlDataSource Control to work with Dro

    - by Shantanu Gupta
    I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="CityName_OnTextChanged"> </asp:DropDownList> <asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" SelectCommand="SELECT * FROM [vcity]" ></asp:SqlDataSource> Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource. I have four columns in datasource i.e. name, id, address, phno. I want to fetch an address of a person who selects some value from ddl.

    Read the article

  • How to get a column value contained in SqlDataSource to a variable.

    - by Shantanu Gupta
    I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="CityName_OnTextChanged"> </asp:DropDownList> <asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" SelectCommand="SELECT * FROM [vcity]" ></asp:SqlDataSource> Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource. I have four columns in datasource i.e. name, id, address, phno. I want to fetch an address of a person who selects some value from ddl.

    Read the article

  • Can I populate multiple DropDownLists from one SqlDataSource using parameters?

    - by death_au
    Basically, I have four asp:DropDownLists and I wish to populate all of them from the same table, with certain conditions. For example, I have this data source: <asp:SqlDataSource ID="ReferenceDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:mrapConnectionString1 %> SelectCommand="SELECT * FROM [reference_data] WHERE ([component] = @component)" > <SelectParameters> <asp:Parameter DefaultValue="MB" Name="component" Type="String" /> </SelectParameters> </asp:SqlDataSource> And I want to know if I can change that component parameter to be different for each of my four dropdown lists. I tried adding the following code on the DataBinding event for my DropDown: ReferenceDataSource1.SelectParameters.Remove(ReferenceDataSource1.SelectParameters["component"]); ReferenceDataSource1.SelectParameters.Add("component", "MB"); But I ironically got a StackOverflowException...

    Read the article

  • How to use jQuery datepicker as a control parameter for SqlDataSource?

    - by Matt
    I have the need to display a date in this format: dd/mm/yyyy. This is actually being stored in an ASP.NET textbox and being used as a control parameter for a select on the GridView. When the query is run, though, the date format should change to 'd M y' (for Oracle). It is not working. Can someone tell me what I'm doing wrong? Right now I am pushing the "new" format to a invisible label and using the label as my control param: $(document).ready(function() { //datepicker for query, shown traditionally but holding an Oracle-needed format $('[id$=txtBeginDate]').datepicker({ minDate: -7 , altFormat: 'd M y' }); //get alt format var altFormat = $('[id$=txtBeginDate]').datepicker("option", "altFormat"); //set date to be altformat $('[id$=lblActualDate]').datepicker("option", "altFormat", 'd M y'); });

    Read the article

  • problem with sqldatasource and data binding

    - by Alexander
    I am trying to pull out data from the table I had from the database according to the id which is passed from the URL. However I always get data from id= 1? Why? FYI I took this code directly from the ClubWebsite starter kit and copy and paste it to my project to make several changes, the ClubWebsite one worked fine.. but this one doesn't and can't find any reason why because they both looked exactly the same. <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Events_View.aspx.cs" Inherits="Events_View" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="splash" Runat="Server"> <div id="splash4">&nbsp;</div> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div id="content"> <div class="post"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubDatabase %>" SelectCommand="SELECT dbo.Events.id, dbo.Events.starttime, dbo.events.endtime, dbo.Events.title, dbo.Events.description, dbo.Events.staticURL, dbo.Events.address FROM dbo.Events"> <SelectParameters> <asp:Parameter Type="Int32" DefaultValue="1" Name="id"></asp:Parameter> </SelectParameters> </asp:SqlDataSource> <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id" AllowPaging="false" Width="100%"> <ItemTemplate> <h2> <asp:Label Text='<%# Eval("title") %>' runat="server" ID="titleLabel" /> </h2> <div> <br /> <p> <asp:Label Text='<%# Eval("address") %>' runat="server" ID="addressLabel" /> </p> <p> <asp:Label Text='<%# Eval("starttime","{0:D}") %>' runat="server" ID="itemdateLabel" /> <br /> <asp:Label Text='<%# ShowDuration(Eval("starttime"),Eval("endtime")) %>' runat="server" ID="Label1" /> </p> </div> <p> <asp:Label Text='<%# Eval("description") %>' runat="server" ID="descriptionLabel" /> </p> </ItemTemplate> </asp:FormView> <div class="dashedline"> </div> </div> </div> </asp:Content> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Data; public partial class Events_View : System.Web.UI.Page { const int INVALIDID = -1; protected void Page_Load(object sender, System.EventArgs e) { SqlDataSource1.SelectParameters["id"].DefaultValue = System.Convert.ToString(EventID); } public int EventID { get { int m_EventID; object id = ViewState["EventID"]; if (id != null) { m_EventID = (int)id; } else { id = Request.QueryString["EventID"]; if (id != null) { m_EventID = System.Convert.ToInt32(id); } else { m_EventID = 1; } ViewState["EventID"] = m_EventID; } return m_EventID; } set { ViewState["EventID"] = value; } } protected void FormView1_DataBound(object sender, System.EventArgs e) { DataRowView view = (DataRowView)(FormView1.DataItem); object o = view["staticURL"]; if (o != null && o != DBNull.Value) { string staticurl = (string)o; if (staticurl != "") { Response.Redirect(staticurl); } } } protected string ShowLocationLink(object locationname, object id) { if (id != null && id != DBNull.Value) { return "At <a href='Locations_view.aspx?LocationID=" + Convert.ToString(id) + "'>" + (string)locationname + "</a><br/>"; } else { return ""; } } protected string ShowDuration(object starttime, object endtime) { DateTime starttimeDT = (DateTime)starttime; if (endtime != null && endtime != DBNull.Value) { DateTime endtimeDT = (DateTime)endtime; if (starttimeDT.Date == endtimeDT.Date) { if (starttimeDT == endtimeDT) { return starttimeDT.ToString("h:mm tt"); } else { return starttimeDT.ToString("h:mm tt") + " - " + endtimeDT.ToString("h:mm tt"); } } else { return "thru " + endtimeDT.ToString("M/d/yy"); } } else { return starttimeDT.ToString("h:mm tt"); } } }

    Read the article

  • Update parameter not working on bound DropDownList

    - by ProfK
    I have a DropDownList declared like this: <asp:DropDownList ID="campaignTypeList" runat="server" Width="150px" DataTextField="Name" DataValueField="CampaignTypeId" DataSourceID="campaignTypesDataSource" SelectedValue='<%# Bind("CampaignTypeID") %>'> </asp:DropDownList> Using the designer, my SqlDataSource is configured as follows1: <asp:SqlDataSource ID="campaignDataSource" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ProVantageMediaManagement %>" SelectCommand="ActivationCampaignGetById" SelectCommandType="StoredProcedure" UpdateCommand="ActivationCampaignUpdate" UpdateCommandType="StoredProcedure"> <SelectParameters> <asp:QueryStringParameter DefaultValue="98" Name="campaignId" Direction="Input" QueryStringField="id" Type="Int32" /> </SelectParameters> <UpdateParameters> <asp:QueryStringParameter DefaultValue="98" Name="campaignId" Direction="Input" QueryStringField="id" Type="Int32" /> <asp:Parameter Name="campaignName" Type="String" /> <asp:Parameter Name="campaignTypeId" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource> Yet when the update command is sent to the DB, the campaignTypeId value is always 1, no matter which item is selected in the DropDownList. What am I doing wrong? 1 Bonus points for telling us what a ControlParameter is meant for, if not for handling values of controls in a scenario like this.

    Read the article

  • Search database with textbox/button, display record in detailsview and update fields

    - by AB
    Hello, I am trying to do all on one page. There are 3 textboxes and 3 buttons, one sqldatasource and one detailsview. Sqidatasource is configured to take parameters from textboxes and ingnore blank textboxes to be able to search by one (any) field at the time. When I do "test query" in sqldatasource - everything is working. Deatailsview is set to have sqldatasoure as datasourse. On each button I do detailsview.databind() but nothing is showing up. Need help, thank you.

    Read the article

  • Why should I use an N-Tier Approach When using an SqlDatasource is ALOT EASIER ?

    - by The_AlienCoder
    When it comes to web development I have always tried to work SMART not HARD. So for along time My Aproach to interacting with databases in my AspNet projects has been this : 1) Create my stored procedures 2) Drag an SQLDatasource control on my aspx page 3) Bind a DataList Control to my SQLDatasource 4) Insert, Update & Delete by using my Datalist or programmatically using built in SQLDatasource methods e.g MySqlDataSource.InsertParameters["author"].DefaultValue = TextBox1.Text; MySqlDataSource.Insert(); Recently however I got a relatively easy web project. So I decided to employ a 3-tier Model...But I got exhausted halfway and just didnt seem worth it ! It seemed like I was working too HARD for a project that could have been easily accomplished by a couple of SqlDataSource Controls. So Why Is the N-Tier Model better than my Approach? Has it anything to do with performance? What are the advantages of the ObjectDataSource control over the SqlDataSource Control?

    Read the article

  • Why I should use an N-Tier Approach When using an SqlDatasource is ALOT EASIER ?

    - by The_AlienCoder
    When it comes to web development I have always tried to work SMART not HARD. So for along time My Aproach to interacting with databases in my AspNet projects has been this : 1) Create my stored procedures 2) Drag an SQLDatasource control on my aspx page 3) Bind a DataList Control to my SQLDatasource 4) Insert, Update & Delete by using my Datalist or programmatically using built in SQLDatasource methods e.g MySqlDataSource.InsertParameters["author"].DefaultValue = TextBox1.Text; MySqlDataSource.Insert(); Recently however I got a relatively easy web project. So I decided to employ a 3-tier Model...But I got exhausted halfway and just didnt seem worth it ! It seemed like I was working too HARD for a project that could have been easily accomplished by a couple of SqlDataSource Controls. So Why Is the N-Tier Model better than my Approach? Has it anything to do with performance? What are the advantages of the ObjectDataSource control over the SqlDataSource Control?

    Read the article

  • sql data source

    - by George
    I have a table (EmployeeID,EmployeeName,ManagerID) How can I create a sqldatasource to include the ManagerName from the EmployeeName given EmployeeID = ManagerID? In my gridview after dragging a dropdownlist what bindings should I do to display the managerName? Is it possible to use it without writing custom select,insert,delete,update? If not what are the steps I need to do to write the whole thing i.e. custom grid and source? Thank you very much

    Read the article

  • Deleting Row Method on GridView

    - by George
    I am trying to implement the deleting method and pass my parameters for the delete operation. I am using sqldatasource. Since the ID doesnt have a column in my gridview how can I get the value of the ID and set it as my delete parameter?

    Read the article

1 2 3 4 5  | Next Page >