Forms Data Controls :: Using Multiple Tables Within A Single DataSet And Single SqlDataSource?
May 19, 2010
I have a stored procedure that returns 3 tables within the single recordset it returns. If I set a SqlDataSource to get data from this procedure, it works, but it only returns the first table. I want to have a GridView display the data from the 2nd or 3rd table using a SqlDataSource, but I can't figure out how to specify a particular table.
While there are some posts discussing this out there, I can't get a definitive answer about whether or not this is even possible (?). In a worst-case scenario, I can create another SP that only returns the 3rd table - but that creates a little maintenance headache that I would prefer to avoid.
Here's the scenario: Buyers and Sellers (where all of the sellers have a unique D&B number).
I'm catering to the buyers, and I want them to be able to import a list of sellers based on the D&B number.
Here are the tables:
BuyersSellers - unique list of sellers - one record, no matter how many buyers work with them.BuyerSellers - lookup table - buyer_id, seller_id sets which buyers work with which sellers ImportedSellers - temp table that holds sellers the buyer wants to add.AllSellers - master table that has all known sellers with D&B numbers (remote database).
Here's the process:
Buyer uploads list of new sellers, they get added to ImportSellers tableMatch ImportedSellers against AllSellers (valid), ignore unmatched (invalid).Add valid ImportedSellers to the Sellers table if they don't exist.Create BuyerSeller records for all valid ImportedSellers - using data from AllSellers.Delete all valid ImportedSellers, leave the unmatched behind so they know what they need to fix.
I've got the upload and import working, but now I'm a little stuck on how to do all of the matching and inserting, and do it as quickly as possible.
After creating a dataset, which has CRUD statements generated two or more tables, which Data Control should I use that will allow me to insert data into fields into 2 or more tables from a single web form. I'm trying to create a web form that will allow the user to input student information, such as general information, medical information, etc.
I am having a hard time solving the following with an MVC view. My goal is to display data from multiple tables in a single MVC view. The bulk of the data comes from a table called Retailers. I also have another table called RetailerCategories which stores the retailerid from the Retailers table and also a categoryid linking to a Category table. Note that there are multiple records for each retailerid in the RetailerCategories table.
In the view I want to show a list of retailers and with each retailer I want to show the list of categories applicable to them. What would be the best way to accomplish this?
I need to know how to display a single row(or particular row)from dataset and display into gridview... i tried by using some codes, like the following, If strCourseLevelId <> "" Then Dim ds2 As DataSet Dim currentbundlenid As Int16 Dim prevbundleid As Int16 = "0" Dim bundlenos As Int16 = "0" Dim bundlecontent As Bundledata = New Bundledata ds2 = bundlecontent.GetBundleData(strCourseLevelId) If ds2.Tables.Count = 1 Then If ds2.Tables(0).Rows.Count > 0 Then With ds2.Tables(0) Dim strCnt As Int16 For strCnt = 0 To .Rows.Count - 1 With .Rows(strCnt) currentbundlenid = .Item("Bundleid") If currentbundlenid <> prevbundleid Then bundlenos = bundlenos + 1 End If If bundlenos = "1" Then GridView1.DataSource = ds2 GridView1.DataBind() ElseIf bundlenos = "2" Then GridView2.DataSource = ds2 GridView2.DataBind() ElseIf bundlenos = "3" Then GridView3.DataSource = ds2 GridView3.DataBind() End If prevbundleid = .Item("Bundleid") 'next write the main page content End With Next End With End If End If.
I have a report displaying the data for an employee. If I wish to generate report for 2 employee, how I can do to make a single report contains both the data? (e.g.: 1st page display data for 1st employee; 2nd page display data for 2nd employee and so on) I need them to be in the same report/pdf file.
I have 3 tables in single database with different strctures,3 tables have unique column(partno or Jobno) , on web form search button input control(textbox) and grid view.I am pulling the data based on column jobno from single table on to grid view using following code
One:Table Name Rider With columns RiderID,LName,City
Two:Table Name Car With columns CarID,RiderID,Color
What I would like to be able to do is to allow the users to do an UPDATE on both tables.
Like if you crreated a SQLDataSource using just one table as it's source. You can use that SQLDataSource for a gridview.
Then in the gridview you can display all the data from the table but you can also EDIT all the data in the table through the gridview.
But if I create a SQLDataSource using 2 table joining them together with an INNER JOIN with a Primary Key in one table and a Foriegn Key in the other table. I can still use this SQLDataSource with a GridView to display the data but I can't EDIT the data through the gridview for the 2 tables.
Is there anyway to do this using a SQLDataSource and GridView?
So I found an example on how to search gridview using filterexpressions on this site (Filter GridView with TextBox using FilterExpression in SqlDataSource in ASP.Net), but now if I try to search with an apostrophe in the textbox, the code fails.
Here's the link to the the article/source - [URL] .....
I have a question in gridview, I want to combine my two or more records into a single cell with two rowsfor Example i have a ID, Name, Year Start, and Year End for Column name in database and i want call it into my gridview that the Year Start and Year End will combine to Year like:
i have grid view with one line per row, I added new field with is large text box 100 chars + and I want it to be in single row below the current row which is embedded from multiple small colums, e.g. name, age, address, etc. What is the simplest and correct way to do it, I am using gridview with item template already.
I have a requirement to create multiple hyperlinks dynamically in a single GridView Column. The number of hyperlinks are not not known in advance and will depend on the results brought up by a query. How do I create the same?
how can I display on a single page(View) data from two tables in my db? In my project the model is *.edmx file. i have two table one with categories, and the second one with products. All I want to do is to display on home page(view) in left column all categories, and all products in right column. After clicking on category in left column, in right column there should be products form category which was clicked....
I have a small query can we store three different stored procedure data into single dataset (in multiple tables). I am asking this because I have three stored procedure and when I run them simultaneously it takes less time to execute and when I run them separately it takes more time and I want to use all three stored procedure in page load. Environment - SQL Server 2005, ASP.net 2.0
Here I'm using three tables given below. As u can see in the below three tables, 3 columns(P_Id,PdtName,PdtImgUrl) are same. Now can any body tell me how can I retreive values of 3 columns(P_Id,PdtName,PdtImgUrl) without repeatition.