Using The SqlDataSource To Get Data .net 2.0

Feb 14, 2006

I am used to using asp.net 1.1
and I want to do the equivilent of the following with an SqlDataSource


da.fill(dst1)
lbl.text=dst1.tablename(0).fieldname


and what this does is fills the dataset with the information from the select command in the dataadapter and then gets the value for the first row of the fieldname

It doesnt seem like this should be that big of a deal, but it has become very frustrating trying to find the answer, does anyone know how to do this? Please post some demo code if possible

View 2 Replies


ADVERTISEMENT

Re-use Data From SqlDataSource

Dec 11, 2006

I have a page containing a FormView, which gets its data from a SqlDataSource control and displays details of a job.  Two of the fields are location and job title.  I want to re-use this data to create a dynamic page title.  I know I can do this by setting the Page.Title to what I want to,  but do I have access to the data outside of the FormView to which the data source is bound?  If so how?   Or will I have to perform an additional SELECT statement to get this data again?

View 2 Replies View Related

Using Data From SqlDataSource

Mar 9, 2006

Hi Everybody,I have an ordinary SqlDataSource on my page <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:P4SConnection %>"                ProviderName="<%$ ConnectionStrings:P4SConnection.ProviderName %>" SelectCommand="SELECT CO_Id,CT_Name,CO_Username,CO_Password,CO_Company,CO_Email,CT_Id,CT_Position,CT_Admin,                CO_Session,CO_LastLogin FROM company_contact LEFT JOIN company ON company_contact.CT_Company = company.CO_Id WHERE (CT_Username= & LCase(txtName.Text) & ">            </asp:SqlDataSource>How do i use any of these values?I know I can display the values in a GridView or something but I dont want to display them.I originaly was using ODBC and just used the followingDim Row As DataRow = thisTable.Rows(0)            Dim lP_ID As String = Row(0).ToString()            Dim TheContact As String = Row(1).ToString()            Dim theName As String = Row(2).ToString()            Dim thePassword As String = Row(3).ToString()            Dim TheCompany As String = Row(4).ToString()            Dim TheEmail As String = Row(5).ToString()            Dim lP_ContactID As String = Row(6).ToString()            Dim ThePosition As String = Row(7).ToString()            Dim bAdmin As Boolean = Row(8).ToString()            Dim sP_Session As String = Row(9).ToString()            Dim sP_Last As String = Row(10).ToString()Then I could use the values wherever I wanted.How do I do this with a SqlDataSource?Thanks,G

View 4 Replies View Related

How To Retrieve Data From Sqldatasource?

Jul 18, 2006

Okay, I used the SQLDataSource control to get my data from the database
table. What or how do I retrieve individual data from the
sqldatasource? I want to do some string comparison and manipulation
before I display it to the browser. How can this be accomplish?

Help is appreciated.

View 21 Replies View Related

Filtering Data Using Sqldatasource

Oct 12, 2006

i HAVE TRIED THE FOLLOWING CODE BUT ITS NOT WORKING AS I WANT TO FILTER IT ACCORDING TO THE VALUE OF DROPDOWNLIST  I HAVE TRIED CONFIGURE THE SQLDATASOURCE. DATASOURCE MODE PROPERTY IS SET TO THE DATASERSTILL IT IS NOT SHOWING ANY RESULTS <%@ Page Language="VB" %> <!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>Untitled Page</title></head><body>    <form id="form1" runat="server">    <div>        <h3>Search Jobs</h3>         <table cellspacing="10">                      <tr>            <td valign="top" style="height: 162px">              <table border="0">                <tr>                  <td valign="top" style="width: 70px">                      Location</td>                  <td><asp:DropDownList runat="server" id="CountryListBox" AppendDataBoundItems="True"                                        DataSourceID="CountrySqlDataSource"                                         DataTextField="location" DataValueField="location" AutoPostBack="True" >                        <asp:ListItem Selected="True" >(Show All)</asp:ListItem>                      </asp:DropDownList>                  </td>                </tr>                <tr>                  <td style="width: 70px">                      Skills</td>                  <td><asp:TextBox runat="server" id="LastNameTextBox" Text="*" /></td>                </tr>                <tr>                  <td style="width: 70px"></td>                  <td><asp:Button runat="server" id="FilterButton" Text="Filter Results" /></td>                </tr>              </table>            </td>             <td valign="top" style="width: 587px; height: 162px;">                              <asp:GridView ID="EmployeesGridView"                DataSourceID="SqlDataSource2"                 DataKeyNames="employeeID"                AutoGenerateColumns="False"                AllowSort="True"                RunAt="server" Height="143px">                                <HeaderStyle backcolor="Navy"                  forecolor="White"/>                                  <RowStyle backcolor="White"/>                                <AlternatingRowStyle backcolor="LightGray"/>                                <EditRowStyle backcolor="LightCyan"/>                  <Columns>                      <asp:BoundField DataField="employeeID" HeaderText="employeeID" ReadOnly="True" SortExpression="employeeID" />                      <asp:BoundField DataField="employeeName" HeaderText="employeeName" SortExpression="employeeName" />                      <asp:BoundField DataField="companyName" HeaderText="companyName" SortExpression="companyName" />                      <asp:BoundField DataField="jobSkills" HeaderText="jobSkills" SortExpression="jobSkills" />                      <asp:BoundField DataField="experiance" HeaderText="experiance" SortExpression="experiance" />                      <asp:BoundField DataField="location" HeaderText="location" SortExpression="location" />                  </Columns>              </asp:GridView>            </td>                          </tr>                    </table>                    <asp:SqlDataSource ID="CountrySqlDataSource"           SelectCommand="SELECT DISTINCT location FROM tlbEmployee"          EnableCaching="True"          CacheDuration="60"          ConnectionString="<%$ ConnectionStrings:ConnectionString %>"          RunAt="server" />         <asp:SqlDataSource ID="EmployeeDetailsSqlDataSource"           SelectCommand="SELECT * FROM [tlbEmployee] WHERE (([location] LIKE '%' + @location + '%') AND ([jobSkills] LIKE '%' + @jobSkills + '%'))"          EnableCaching="True"          CacheDuration="60"          ConnectionString="<%$ ConnectionStrings:ConnectionString %>"          FilterExpression="location LIKE '{0}' AND jobSkills LIKE '{1}'"          RunAt="server">           <FilterParameters>            <asp:ControlParameter ControlID="CountryListBox"   PropertyName="SelectedValue" />            <asp:ControlParameter ControlID="LastNameTextBox" PropertyName="Text" />          </FilterParameters>            <SelectParameters>                <asp:ControlParameter ControlID="CountryListBox" Name="location" PropertyName="SelectedValue"                    Type="String" />                <asp:ControlParameter ControlID="LastNameTextBox" Name="jobSkills" PropertyName="Text"                    Type="String" />            </SelectParameters>        </asp:SqlDataSource>        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"            SelectCommand="SELECT DISTINCT location FROM tlbEmployee"></asp:SqlDataSource>        </div>        <asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource>    </form></body></html> 

View 1 Replies View Related

Get Data From SqlDataSource For Selected Row

Feb 24, 2007

Hello all! How can I get data from SqlDataSource for row selected in GridView?

View 3 Replies View Related

How To Access Data Using SqlDataSource

Aug 27, 2007

Hello all,I have what I think should be a simple problem to solve but I just don't quite understand what to do (.NET Framework Developer Center confused me :( ).My code should load the highest SiteID, known as Last_ID into the siteIdBox when the form is in insert mode.  My difficulty is in understanding how to use the sqlDataSource correctly.  Dim dsLastId As New SqlDataSource() Dim siteIdBox As TextBox Dim dsmLastId As SqlDataSourceMode If FV_Site.CurrentMode = FormViewMode.Insert Then Try
dsLastId.ConnectionString = ConfigurationManager.ConnectionStrings("AquaConnectionString1").ToString dsLastId.SelectCommandType = SqlDataSourceCommandType.Text dsLastId.SelectCommand = "SELECT MAX(Site_ID) AS Last_ID FROM Tbl_Site"

dsmLastId = SqlDataSourceMode.DataReader

siteIdBox.Text = dsmLastId.?????

Finally
dsLastId = Nothing End Try End If  If anyone could tell me the code for getting the value from the select statement into the textbox, I would be most grateful.Thank you, m00sie. 

View 4 Replies View Related

InsertCommand Using Data From A Second SqlDataSource - ASP.NET 2.0

Nov 29, 2007

I have a process that inserts a new record using the InsertCommand of a SqlDataSource.  As part of the process, I need to insert data the is available in a different SqlDataSource.  I was trying this with the Insert Parameter:

View 1 Replies View Related

Manipulating Data In Sqldatasource

Jan 16, 2008

[I am new to asp.net]
Assume I have a databse for "products"; product id is a primary key.
Here is what I am trying to:
1. DetailsView for a product (eg id = 1110) (I got this far)
2. how can I list other products starting with 111x id
3. I also to show them on same page as 1110 as "parent" 111x as children
 Thanks,

View 5 Replies View Related

Retrieve Data From SQLDataSource

Jan 23, 2008

Background:I am using Visual Studio 2005 Standard SP1 to create an ASP.NET website that accesses an SQL 2005 database.  I am using vb.net as well.I am passing an ID in a query string from one page to the next, where I retrieve it using an SQLDataSource.  The data will only be one row; it is returning customer information.Problem:I need to be able to get specific fields from the SQLDataSource and populate some textboxes.  Honestly, I'm not really sure where to begin.  For the sake of argument, let's say that I am working with this:'My TextboxDim LastName As Textbox'My SQLDataSource (filtered by query string using the customer's ID to only get 1 customer's information at a time)SQLDataQuestion:So, how would I go about retrieving the lastname field from SQLData and inserting it into the textbox LastName?Thanks,    J'Tok

View 2 Replies View Related

How To Get Data Based On Value Of Another Sqldatasource

Feb 17, 2008

1st of all i'm using 3.5 and c#.
 On my page I have 2 sqldatasource controls. sds1 and sds2
 In my select statement of sds2 how do I make a select parameter based on a value or column I return from sds1? And please don't tell me to join my sds2 select in sds1, I don't want to do that. I need two seperate sds.

View 4 Replies View Related

Caching Data With SqlDataSource

Mar 14, 2008

Hello, every one! This is my first post on the forum. I got some questions about caching data with SqlDataSource controls in asp.net 2005. Here are them:    According to the vs.net 2005 documents, SqlDataSource controls will sustain an individual cache for each combination of ConnectionString, SelectCommand and values of SelectParameters. But how about FilterExpression and FilterParameters? If I enable caching and change the FilterExpression or values of FilterParameters, will the SelectCommand be reexcuted, or will the databinding controls just get data from the existing cache? And will multiple SqlDataSource controls with the same combination of ConnectionString, SelectCommand and values of SelectParameters share a common cache, or sustain caches of their own?

View 1 Replies View Related

Accessing Data From The SQLDataSource.

Apr 5, 2008

I am using a drap and drop SQLDataSource control.  Everything works like I am wanting it to, but I want to check a value from one of the fields that I have retrieved.  I am lost as how to retreive just the field.  If I have to create another dataset to do the work what is the point of using the drag and drop control?  I would really like to just access the dataset fields as needed.

View 2 Replies View Related

How Get Data From SqlDataSource Into CodeBehind?

Apr 6, 2008

Hello...Can someone help me?I´m getting info of a product via sqldatasource in this way:<asp:SqlDataSource ID="myData" runat="server" ConnectionString="..." SelectCommand="spGetProduct" SelectCommandType="StoredProcedure">                       <SelectParameters>      <asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="String" />   </SelectParameters></asp:SqlDataSource>In my ASPX page I get the data in this way:<asp:Repeater ID="repProduct" runat="server" DataSourceID="myData">   <ItemTemplate>      <p><%# Eval ( "ProductName") %></p>   </ItemTemplate></asp:Repeater> My problem is in my code behind because I need some data from this DataSource.For example, I want the Product Name as the page title. So the question is how I get something like this in my code behind:protected void Page_Load ( object sender, EventArgs e ){    this.Page.Title = Eval ( "ProductName") ;}Thanks! 

View 2 Replies View Related

Can I Get Data From Sqldatasource With Codebehind?

Apr 13, 2008

Hi, I don't know if i's a silly question.
Now I want to get data from sqldatasource by only write some code,I don't know without creat some data control components if it can be true?
If it can do,how can I write the codes?
Especially I don't know how to write the code witch can "read" data.

View 3 Replies View Related

Filtered Data And SQLDatasource

Apr 21, 2008

In asp.net 3.5.....
To get the number of rows returned when the select is executed.......
 Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Selected        Session("MessageText") = e.AffectedRows & " Profile(s)"End Sub
How do you get the number of rows returned when you apply a filter expression to a selection of rows?
Thanks
Craig

View 3 Replies View Related

Fetch Data From Sqldatasource

Jun 4, 2008

hi,im just a newbie in asp.net.i have my sqldatasource and a label. i want to get the data from sqldatasource to the label. how can i do that.need codes 

View 2 Replies View Related

SQLDataSource Relational Data

Nov 14, 2005

I am just now starting the switch from .NET 1.1 to .NET 2.0.  I really like the new way of using the SQLDataSource and setting up Views declaratively as opposed to doing it all in code, which brings me to my question.In some of my applications I have a single Stored Procedure return multiple result sets to a single DataSet where I have a DataRelation set up.  Then I can have nested DataGrids that use the GetChildRows() method to filter the results to display the hierarchical data.  I would like to do something similar with the SQLDataSource and GridViews but haven't found a way to get multiple result sets.One thought I had was to create a Strongly Typed Dataset and then use the ObjectDataSource object, but I still didn't see a way to get child rows out of the datasource.  I've seen an example that uses a <FilterParameter> to get nested data, but there is an extra trip made to the server for each parent item as it just put an extra parameter in the WHERE clause of the query.

View 1 Replies View Related

Sqldatasource Data In Code Behind

Apr 21, 2006

I have a sqldatasource in the markup. This is in turn connected to a Gridview. I use Eval to retrieve the database information in the markup but I also need the Eval information in code behind.  How can I do this?
I got this far but how (if it's possible this way) can I retrive it?
Protected Sub Test(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
this is where i want to get the "MyData" value from the database.
End If
........
 
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="test" DataSourceID="SqlDataSource1" UseAccessibleHeader="False" GridLines="None" ShowHeader="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>   


<asp:HiddenField ID="Hiddenvalue" runat=server Value='<%# Eval("MyData") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
 
using VB..
 
 

View 1 Replies View Related

Copying SQLDataSource Data Into DataSet

Feb 2, 2007

is there a way to copy a SqlDataSource Data into a dataset?

View 4 Replies View Related

Updating Data With SqlDataSource Object

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

Accessing Data Directly From A SqlDataSource?

Mar 7, 2007

First let me give you a little back ground on me.  I'm very new to the ASP, ASP.NET, Visual Studio, Sql Server, Frameworks....thing.  I am coming over from a PHP/MySql background of over 5 years.  The change over to VBScript and VB has been to tough and I have a basic liking for the Visual Studio 2005 and the ease of putting things together.  However, I have come across something that to me seems like it should be relatively simple, but haven't been able to find the documentation or samples to describe what I'm looking to do.
Rough Need:
1.  Start with a form will a couple labels and a singe textbox to get the lookup date from an user.
2.  Query one table/view based on the users choice of date and select only one field of returned data.(Doing this by itself is not a problem and I can display my results in a Gridview, but this is where it starts getting tricky and the gridviews won't work for me.)
3.  If there is something returned, I need to start a HTML table layout or possibly some form of a Gridview(I don't see how I would use the Gridview) and start a loop, adding the first returned row from this query into the first cell.
4.  Now, based on that same User Date and the returned row value from the previous query, I need to query another Table/view and return another single field, which might return 1 or multiple rows, which I need to start a loop to display unique items in cells under the first on above.
5.  Based on the original User Date and each returned row from the first query, I need to query two other Table/views and get some additional information.  4-5 fields will be returned and be displayed on one row in the number of necessary columns.
6.  This would finish the first row from the first query, so I would need to loop back up to see if there were any further results and continue looping until the get to the last of the results from the first query.
7.  Finally, I would just need to close up the Table/gridview.
The basic results I'm looking for would be similar to the following:
Results for 10/11/2005



Field name 1
Field name 2
Field name 3
Field name 4
Field name 5



First Result from query 11 of 4 results from Query 2, but only 1 unique result

Info from Query 3

Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4

Info from Query 3
Info from Query 3.
Info from Query 3
Info from Query 4
Info from Query 4

Info from Query 3

Info from Query 3   
 
Info from Query 3
Info from Query 4
Info from Query 4

Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4



Second Result from query 1First result from Query 2 after looping though the first query Second result from Query 2 after looping though the first query

Info from Query 3

Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4

Info from Query 3
Info from Query 3.
Info from Query 3
Info from Query 4
Info from Query 4

Info from Query 3

Info from Query 3   
 
Info from Query 3
Info from Query 4
Info from Query 4

Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
It seems me from what I have read and slowly figuring out, is that I should be able to directly access the DataSet returned by four SqlDataSources, one for each of the above querys and then just write my own VB to handle the necessary looping, table format and such.  I can easily add the for SqlDataSources to the page and add a Gridview for each one and get 4 separate chunks of info, but can't see a way with GridViews to intermingle the info like displayed above.
So, if it can be done with Gridviews, then I would love to see how that is done.  But, if someone could explain to me how I access the DataSets directly that I get from the 4 SqlDataSources, then that would be ok too.  I have figured enough out with VB, that I can write the code to do my looping requirements, if I can just access the information I get back.  Thanks for reading all the way through this long post.
 Jack 

View 1 Replies View Related

Move Data From SqlDataSource To A TextBox

Apr 9, 2007

I have a DataReader on a web page: <asp:SqlDataSource ID="ChangeInfoRecord" runat="server" ConnectionString..........
I want to display the value of one of the returned field in a text box.  What is the correct syntax?  I tried
RolledFromDisplay.Text = ChangeInfoRecord("RolledFrom")
but that isn't it.

View 1 Replies View Related

Insert Data With Parameters And Sqldatasource

Apr 24, 2007

I have a sqldatasource in a wizard. When I click the finishbutton in the wizard I want to insert some values (from textboxes, dropdownlists in my wizard) into a mysql-database. For this I use parameters, I add some values in the design mode and some in codebehind. The parameters in codebehind are added perfectly but the other parameters in designmode (name, email) just inserts null. Why?  My datasource: <asp:SqlDataSource
ID="dsInsert"
InsertCommand="INSERT INTO tbltest (name, email, city) VALUES (?name, ?email, ?city)"
runat="server"
ConnectionString="<%$ ConnectionStrings:conn %>"
ProviderName="MySql.Data.MySqlClient">
<InsertParameters>
<asp:FormParameter Name="?name" ConvertEmptyStringToNull="true" Type="string" FormField="name" />
<asp:FormParameter Name="?email" ConvertEmptyStringToNull="true" Type="string" FormField="email" />
</InsertParameters>
</asp:SqlDataSource>   The codebehind:         protected void finishButtonClick(object sender, EventArgs e)        {            dsInsert.InsertParameters.Add("?city", TypeCode.Int32, city.SelectedValue);            dsInsert.Insert();        }

View 3 Replies View Related

SQLDATASOURCE ~ ACCESSING DATA PROGRAMATICALLY

May 9, 2007

Can anyone point me in the direction of code that will allow me to acce3ss the data held in an SQLDataSource.
 
The Control is link Selection Staement has been set at run, what I want to do is loop thru any data that is rertrieved, setting oter controls on the page depending on values
 Thanks
 Steve (I have not got much hair left, please help soon)

View 3 Replies View Related

Retrieve Data From A SQLDatasource Object.

May 21, 2007

I'm an "old" programmer but new to ASP.NET.
I want to get a value from the SQL Dataset.
What I would normally do in other environments is iterate through the dataset to get the value I would be intrested in, but I can't figure out how to do this without using a visual data display object like a Grid view.
Typically I want to get a value from the database that I then after manipulating it, like multply by 5, use to format something on the page.
thanks in advance,
Thommie
 

View 3 Replies View Related

SQLDatasource And Dropdowns && Extra Data

May 27, 2007

I’m using a SQLDataSource to populate a dropdown. The SQL table I use to populate the drop down has two columns. I only want one of them to be displayed in the drop down but I need to make decisions later in the code based on both columns. How do I access that second column in the datasource?

View 4 Replies View Related

How To Retrieve Data From A SQLDataSource Control

Jun 10, 2007

I have made a SQLDataSource control with the select command:
SELECT COUNT(*) AS 'Antall' FROM Utgivelse WHERE (medieID = @medieID)
I want to use the "Antall" result programmatically in C# code. I try the following statement:        IDataReader MyReader;
 
       MyReader = CType(SqlDataSource2.Select(DataSourceSelectArguments.Empty),IDataReader);
but it doesnot work. Can somebody help me how to get the data from th control ?
Tom

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

Display 1 Piece Of Data From A SQLDataSource

Jul 23, 2007

I have the following sqlDataSource. I wan't to display one piece of data, not a whole row, from it. I can find lots of information on putting it into a datagrid, but nothing on puttin one piece in a textbox. I cannot use a formview as we are embedding html in  response.write and it breaks in a formview. Thanks. 
 
<asp:SqlDataSource runat="server"
             ID="myEmpInfo"
SelectCommand="Select di.EmpInfo,di.eth,gc.t_level         From tblEmp di
        ,tblMisc gc
Where di.empnum = @empnumand di.empnum = gc.empnum" DataSourceMode="DataReader" ConnectionString="<%$ ConnectionStrings : myConnectionString %>">
 
<SelectParameters>
<asp:QueryStringParameter Name="empnum" QueryStringField="empnum"/>
</SelectParameters>
 
</asp:SqlDataSource>

View 1 Replies View Related

How To Retrieve Data From Sqldatasource To Textbox

Sep 4, 2007

 my problem is i can't retrieve data from my sqldatasource to be displayed in textbox... i try to do it in vb codes. somebody help me here?

View 4 Replies View Related

Using SQLDataSource To Insert And Select Data

Dec 12, 2007

I'm a traditional asp guy and I'm having a heck of a time getting my arms around this SQLDataSource provided in ASP.NET 2.0
I've setup the Connection String and successfully used the SQLDataSource.Insert method. 
I can't for the life of me figure out how to use the SQLDataSource.Select command. 
I want to get the @@IDENTITY of the last record inserted. 
Example:
---Works Fine---
SQLDataSource.InsertCommand = "Insert into Engines(Type, Description)values('" & DrpType.Text & "', '" & txtDescription.Text & "')"
SQLDataSource.Insert()
--- End Works Fine------- Doesn't Work---
SQLDataSource.SelectCommand = "Select @@IDENTITY as 'Identity'"    
set RecordSetVar = SQLDataSource.Select <--- this wants some kind of arguements
--- End Doesn't Work---
 

View 1 Replies View Related

How To Fill Textbox With Data Using Sqldatasource?

Jan 30, 2008

I want to fill text box using sqldatasource ...
how can i do that ??
thanx in advace ..

View 10 Replies View Related







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