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


ADVERTISEMENT

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

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

Accessing Data From A Programmatically Created SqlDataSource

Nov 3, 2007

Hi
I think I've programmatically created a SqlDataSource - which is what I want to do; but I can't seem to access details from the source - row 1, column 1, for example????
If Not Page.IsPostBack Then
'Start by determining the connection string valueDim connString As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
'Create a SqlConnection instanceUsing connString
'Specify the SQL query
Const sql As String = "SELECT eventID FROM viewEvents WHERE eventID=17"
'Create a SqlCommand instanceDim myCommand As New Data.SqlClient.SqlCommand(sql, connString)
'Get back a DataSetDim myDataSet As New Data.DataSet
'Create a SqlDataAdapter instanceDim myAdapter As New Data.SqlClient.SqlDataAdapter(myCommand)
myAdapter.Fill(myDataSet)Label1.Text = myAdapter.Tables.Rows(0).Item("eventID").ToString() -??????????????
'Close the connection
connString.Close()
End Using
End IfThanks for any helpRichard
 

View 1 Replies View Related

Programatically Get Values From Sqldatasource

Oct 1, 2007

Hi All,
I am having problems getting values out of an sqldatasource.
I have 2 on the page, i am using one to insert into a table and the other to get a couple of values from another table for the insert.
the datasource i am trying to get the values from does a select with a querystring filter i need to grab a couple of fields out of it trhen do the insert on the other datasiource with a button click.
The insert is fine, i just don't know how to get the values out of the first 'select source'
Any pointers or suggestions most appreciated.
Cheers

View 2 Replies View Related

Change SqlDataSource Programatically

Jun 10, 2008

I have a list box populated by a SqlDataSource with a basic statement of Select name where location = @location.       Location is bound to a dropdownlist control.  I want to have a checkbox for the Location dropdownlist and a checkbox for another dropdownlist (for the alphabet) that will select only those people with a last name of the letter selected.  Changing the checkbox would change the sql statement. 
OK so there are two questions here:
1.  How can I write a sql statement that would select only people whos last name begins with a certain letter.  Would it use some sort of convert function to a string with only 1 letter?
2.  How can I programatically change the sqlDataSource's 'select' statement.  I need to switch between sorting by location and sorting by alphabetical last name.  All of my previous experience has had me configuring the datasource in the asp.net code. 
 
Thanks in Advance. 

View 7 Replies View Related

SQLDatasource - Managing Programatically

Nov 25, 2005

HiI'm trying to access the properties of my datasource programatically so I can change the stored procedure it connects to depending on the value of a querystringIn my page load I have
Dim myMode = Request.Params("mode")Select Case myMode   Case "Category"      sqldatasource1.SelectCommand = "productsbycategory"      sqldatasource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure      ******'Need to add querystring parameter   Case "Wishlist"      sqldatasource1.SelectCommand = "productsbywishlist"      sqldatasource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure      ******'Need to add Session variable parameter   Case Else      sqldatasource1.SelectCommand = "allProducts"      sqldatasource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedureEnd SelectThe problem that I have is that I need to pass a parameter to the first 2 procedures above, a querystring to the first and a session variable to the second.How do I add parameters programaticallyMany thanks

View 2 Replies View Related

Programatically Change Sqldatasource Select Statement

Oct 28, 2007

Hi Everyone,
I am trying to change the select statement of an sqldatasource if a check box is checked.
I am using the SqlDataSourceSelectingEventArgs but i can't get it to work, anyone got any pointers?
Code BehindProtected Sub LocMan_Searching(ByVal sender As Object, ByVal e As SqlDataSourceSelectingEventArgs) Handles LocManSearch.Selecting
If cb_Today.Checked = True ThenLocManSearch.SelectCommand = "SELECT * FROM [LocMan_CV] WHERE ([area] LIKE '%' + " & dd_Area.SelectedValue.ToString() & "+ '%') AND [available] LIKE '%' + " & Date.Today & "+ '%')"
 
Else : LocManSearch.SelectCommand = "SELECT * FROM [LocMan_CV] WHERE ([area] LIKE '%' + " & dd_Area.SelectedValue.ToString() & " + '%')"
End If
End Sub
My SQLDATSOURCE
<asp:SqlDataSource ID="LocManSearch" runat="server" ConnectionString="<%$ ConnectionStrings:MYLOCDEVConnectionString %>" >
<SelectParameters>
<asp:ControlParameter ControlID="dd_Area" Name="area" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
 
Thanks in advance
Chris

View 6 Replies View Related

Accessing Value From SqlDataSource

Jan 24, 2007

I have a SqlDataSource that returns a list of companies and their details by ProductID.  It also returns the name of the product associated with the ProductID as the final column (which means it appears for every record returned).  I already have a way of determining how many rows were returned, and use that information in a label to say "Your search has returned x records". protected void dsGetSuppliersByProduct_Selected(object sender, SqlDataSourceStatusEventArgs e)    {        int RecordCount = e.AffectedRows;        if (RecordCount == 0)        { lblRecordCount.Text = "<p>No Records found"; }        else        {            if (RecordCount == 1)            { lblRecordCount.Text = "<p>Your search returned 1 record"; }            else            { lblRecordCount.Text = "<p>Your search returned " + RecordCount + " records"; }        }        string ProductName;    }How can I access the ProductName value so that I can extend the label text to say "Your search has returned x records for <ProductName>" ?

View 1 Replies View Related

Accessing SqlDataSource's Value In Code Behind

May 30, 2007

Hi guys,

I have following query in stored procedure  Select ContractId, Version, CreateDate, body, IsCurrentFrom CRM_Contracts where ContractId=@ContractId I am trying to access the value of IsCurrent field in Code behind using sqlDataSource to hide a radiobutton list in Formview control's when it is in Edit Mode.  How can i do this.  

View 1 Replies View Related

Programmatically Accessing An SQLDataSource With A SELECT COUNT(*) Query.

Jun 20, 2007

I've found example code of accessing an SQLDataSource and even have it working in my own code - an example would be  Dim datastuff As DataView = CType(srcSoftwareSelected.Select(DataSourceSelectArguments.Empty), DataView)  Dim row As DataRow = datastuff.Table.Rows(0)   Dim installtype As Integer = row("InstallMethod")  Dim install As String = row("Install").ToString  Dim notes As String = row("Notes").ToString The above only works on a single row, of course. If I needed more, I know I can loop it.The query in srcSoftwareSelected is something like "SELECT InstallMethod, Install, Notes FROM Software"My problem lies in trying to access the data in a simliar way when I'm using a SELECT COUNT query. Dim datastuff As DataView = CType(srcSoftwareUsage.Select(DataSourceSelectArguments.Empty), DataView) Dim row As DataRow = datastuff.Table.Rows(0) Dim count As Integer = row("rowcnt") The query here is "SELECT COUNT(*) as rowcnt FROM Software"The variable count is 1 every time I query this, no matter what the actual count is. I know I've got to be accessing the incorrect data member in the 2nd query because a gridview tied to srcSoftwareUsage (the SQLDataSource) always displays the correct value. Where am I going wrong here?  

View 6 Replies View Related

Changing Data Source Programatically Does Not Transfer Data

Aug 29, 2006

I have created a SSIS package that transfer data from a Foxpro database to an instance of SQL Server 2005 Express. I used the wizard to create the package but I load and execute the package within a custom application that I have written in C#.

The way the custom application is intended to work is that the user can have the database in any location on the computer and all he has to do is specify the location then the application programatically changes the location of the source on the package that it has loaded and then execute it. When I initially run the package the first time (using the original path), it works fine and transfers the data. However, every subsequent time I run the application and specify a different path, the database on the SQL Server side gets created as expected but the data is not transfered!

Where am I going wrong? Do I need to save the package after I modify the source then reload and run it again or do i need to change something else in the Data Flow to make this work?

View 4 Replies View Related

Programatically Viewing The Data In A Particular Column

Oct 10, 2006

This is my first attempt to create a Vb.net class as well as my first attempt to programmatically view SQL retrieved data as opposed to using the built-in data controls...so be gentle.My question is looking at the code below which I have already put together...how do I actually see what the data is in a particular column...  One of my columns for example is the "Title" which contains the Page Title for Search Engine Optomization.  I need to be able to read this value so I can assign it to the Page.'First Do a Database ConnectionIf Not Page.IsPostBack Then'Start by determining the connection string valueDim connString As String = _ConfigurationManager.ConnectionStrings("CMConnectionString").ConnectionString'Create a SqlConnection instanceUsing myConnection As New SqlConnection(connString)'Specify the SQL queryConst sql As String = "SELECT * FROM SEO where ParentType='Department' AND ParentLevel='0' "'Create a SqlCommand instanceDim myCommand As New SqlCommand(sql, myConnection)'Get back a DataSetDim myDataSet As New DataSet'Create a SqlDataAdapter instanceDim myAdapter As New SqlDataAdapter(myCommand)myAdapter.Fill(myDataSet, "SEO")'Create a DataViewDim myDataView As New DataViewmyDataView.Table = myDataSet.Tables("SEO")'Ok...this is where I'm lost.  Now how do I look up the value for the column "Title" in this Dataset'Close the connectionmyConnection.Close()'End database connectionsEnd Using 

View 6 Replies View Related

Creating An MS SQL Data Table Programatically

Aug 27, 2005

I use Visual Studio and VB.

If I want to create an SQL data table on the server, I go to Server
Explorer and make a small table with the corerct columns. Then I add
rows programatically as needed from the Application I'm working with.

It would suit me, for a current job, to be able to create the table itself programatically.

I don't know how to do this. Can it be done ? If so, could someone give
me a starter, please ? Four cols with a key in the first.

David Morley

View 1 Replies View Related

I Am Accessing Data Using Data Access Pages In IIS 7 To SQL Server 2005 Authentication Is Failing

Feb 5, 2007

is there a step by step paper to get there? here is what i need to consider. I Iwill have many customers that will need their own set of records and access pages "branded for their company" each customer will have many clients. I am hosting this application on a windows 2003 server with SQL 2005 server enterprise.

I am using windows authentication, I have created a username in windows, then i added the windows user in SQL management studio in security, granted "DB Read" and "DB write" and again under the database security tab. still from the web authentication fails. i must be nissing a step or two?

I expect to set up a username for each database as i setup new customers.

View 1 Replies View Related

Data Access :: Users Get Wrong Data Records - Cross Coupling When Accessing Files From MVC App

Aug 7, 2015

I have an MVC asp.net application that stores many records in a table on sql server, in its own system.  used the system for 2 months, worked fine accessing, changing data.

Now that other users are logging in? there is cross coupling going on.  one user gets the data from another users sql search.

In the mvc app it had used the get async method to read the ID record from the db, i set that to synchronous.  no effect;  the user makes their own login id but that does nt matter either.

View 8 Replies View Related

Accessing Data In A Column

Oct 18, 2006

I have a SQLDataSource returning data for a formview.  This should be a simple question that I cannot find an answer to.  The SQLDataSource is returning only one row of data.  How do I access the value of one of the columns?Thanks for the information.

View 3 Replies View Related

Accessing Data In Different Database

Jan 22, 2007

Hello Everyone,
  Is it possible to write a query that can access data in differnt database so I have "trainee" and "training" databases. In want to access one training  table in trainee database through a query. How can I  do this.
 
Thanks.

View 1 Replies View Related

Code For Accessing Data

Jan 3, 2008

Does anyone have code to access data? I want to create a sqldatasource control on the page, but would like to programmatically/manually/code-behind-wise to fill in my queries and their parameters. Thanks! 

View 6 Replies View Related

Accessing Data In One Field

Jun 20, 2008

There has to be a better way (less code) to grab the data in one field than:string sql0 = "Select PSI from agentRate where agent='" + agent + "'";
SqlCommand command0 = new SqlCommand(sql0, conn2);SqlDataReader dr0 = command0.ExecuteReader();
string PSI="";while (dr0.Read())
{PSI = (string)dr0["PSI"];
}
dr0.Close();
 
Any Thoughts?

View 4 Replies View Related

About Accessing Data From Sqlserver

Sep 15, 2005

Hello sir,I have installed .net1.1version on windows2003 operating system.I have also installed sqlserver2000  on the same system.My problem is that when i am trying to get data from sqlserver from asp.net program i am getting error as 'access denied to user NT AUTHORITY/NETWORK USER'.I request you to kindly suggest me with an appropriate solution.Thanking you.Please email me on:-aanandkumar786@yahoo.com

View 1 Replies View Related

Accessing Data Across 6.5 Servers

Jun 22, 1999

Hi,

I need to access data across my sql servers . All the servers are 6.5. Think MS DTC is the solution. But how to implement the same. Can somebody give me step by step instructions.

Thanks in Advance.

Cheers

View 1 Replies View Related

Oracle Accessing Data

Oct 22, 2001

There is any tools or products that allow Oracle Users to access SQL 2000 data in realtime? I know how to go in the opposite direction using linked servers, but am not sure on this direction,

Thanks
David

View 1 Replies View Related

Accessing AS400 Data

Jun 17, 2005

I've been trying to use the integrations services to access AS400 data with almost no success.   Any suggestions or help you can give me would be appreciated.  Some of the issues I can't make sense of are the following.

View 11 Replies View Related

Accessing Different Languages Data

Jan 24, 2008



Hi,

My source is Excel and one column has data in different languages. But when i try loading it to my Database errant data gets loaded.
I tried loading data to Flat file with no success.

Thanks in advance.

View 1 Replies View Related

Accessing SQL Server Data Using Thread

Sep 17, 2007

Hi,
How do we set credentials or contex to a thread.
I create a new thread and within that thread if I am use a connetion string with Integrated Security=True" to talk to the SQL Server, however it seems that the new thread's context/identity is blank and hence failing the SQL Server connection.
Please help.
Thanks
 
 

View 2 Replies View Related

Accessing Database Data In ASP.NET 2.0 - Best Practices?

Dec 31, 2007

I was wondering if you guys know of a good site that talks about programmatically accessing and displaying data from a sql server 05 database in ASP.NET 2.0.I want to have a data adapter in a dataset, but I would like to create my own class file and pull the data from the adapter through code into the class. Is this the best way? Im wondering about the best practices while learning this new technology. Any articles provided would be appreciated. Thanks!

View 2 Replies View Related

Accessing Data Structure Of A MS SQL Database

Mar 19, 2008

I have written 5 content-management systems and am getting a little bored writing a lot of the same functionality and tweaking it for different datamodels.  Is there a way within .NET to have visibility of a database's structure (ie, data type, column names, foreign keys etc)?  I'd like to write up a dynamically generated form for any given table, displaying appropriate form controls based on data type and foreign keys.

View 7 Replies View Related

Accessing Sql Server Data From Unix

Apr 5, 2001

Hello !

I am owrking in java developmenton solaris using weblogic6.0
Does any body know how to access sql server data from solaris.
If some body knows that, can you please post me the steps
that i need to do it.

Thanks
Veena

View 3 Replies View Related

Problem In Accessing Remote Data?

Jun 26, 2000

hi,

I am trying to access data from a remote database which is on SQL SERVER from my local SQL SERVER.. the below is my query..

select * from Remote_server.Remote_DB.dbo.RemoteTable

When i execute this query...

I get a error message..

Server: Msg 7411, Level 16, State 1, Line 1
Server 'remote_server' is not configured for DATA ACCESS.

I added my local server in the remote server as linked server

can anyone tell me the sol...

thanks

View 1 Replies View Related

Accessing Data From VB6 - Query Builder&#39;s

Jan 7, 1999

We have SQL Server 6.5 with an Access 8.0 front-end. We are about to re-write our front-end in VB6 using RDO. Obviously Access has a nice fast and easy to use query builder. My question therefore is - is there any such query builder that can be used within VB6 to simplify query writing ? Or do I have to write all query's and and stored procedures using straight SQL and/or stored procedures. I do not want to use Visdata as it doesn't appear up to the task.

Thankyou whoever helps

Paul

View 1 Replies View Related

Accessing External Data From SQL Server

Mar 21, 2007

Hi,I have a Sybase dataserver containing lots of (huge) tables that Iwould like to access from SQL Server (two different applications,using two different datasources, now want to talk to each other). MSAccess has a feature for 'linking' external data. Can I do similarstuff in SQL Server?Basically, I am trying to avoid having to duplicate the data in boththe dataservers and worry about keeping them in sync.Regards,Tanveer

View 3 Replies View Related

Accessing Shared Data Source In VS.net

Aug 10, 2007



How can i get the shared data sources i created in the report manager to be available in VS.net to be able to assign to a report. I want to be able to create the shared data source first in Report manager and then be able to assign it a report in VS.Net



Thanks.

View 4 Replies View Related







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