DataSource Controls :: Get Data From More Than One Table?

Aug 5, 2010

how can I get data from more than one table using sqldatasource,,, am trying the following code but i get error "Invalid column name 'Category_tbl.CategoryI"

[Code]....

View 3 Replies


Similar Messages:

DataSource Controls :: Way To Retrieve Data From A Table, Modify And Insert It Into Another Table

Jun 13, 2010

Basically i deal with two tables.i have a table T1 of the following format:id company_name i need to read this data and create a table T2 as followsi wrote the following code. it worked fine for retrieving data and modification but fails to insert the modified data into the 2nd table.the error is, it does not recognise the value for @token

ArrayList dynarr=new ArrayList(); // global variable
protected void Button2_Click(object sender, EventArgs e)
{
int row = 1; int i;
string strcmd = null;
string Connection = "Data Source=....";
SqlConnection conn = new SqlConnection(Connection);
string str = "select company_name from T1 where ID=@ID";
[code]...

View 2 Replies

DataSource Controls :: Can Transfer Data From A Table To Another Table

May 15, 2010

May you tell me how can I transfer data from a table to another table, the condition of non-repetition rows

as a procedure in database MS QSL server 2005 ,Works in the first day of the month I use the first table in the prodation environment it is contain the employee data and the second to update first table only

View 4 Replies

DataSource Controls :: Trying To Get Data From More Than One Table?

Aug 5, 2010

am trying to get data from more than one table but I think I have an error in the syntax plz anyone can help methis is the code

[Code]....

View 6 Replies

DataSource Controls :: Fetch Some Data From Sql Table

May 9, 2010

I have a small problem I want to fetch some data from sql table. Table looks like as

sno acno amnout cash
1 A-100 5000 withdrawal
2 A-101 7000 Deposit
3 A-100 8000 Deposit
4 A-101 6000 Deposit
5 A-101 1000 withdrawal

And i want to records something like this:

acno Deposit withdrawal
A-100 8000 5000
A-101 13000 1000

View 5 Replies

DataSource Controls :: Data Suddenly Changes In The SQL Table

Jan 12, 2010

I have a big problem, some how i changed the CreateNewBoundFile, because the heading were mispell (Qrt instead of Qtr. I only changed the BOLD part.

strQuery = "SELECT [Industry Title] AS Industry_Title, [Area Name] AS Area_Name, [Year], [Ownership Title] AS Ownership_Title, [Ownership Code] AS Ownership_Code, [NAICS Code] AS NAICS_Code, [Qrt 1 Disclosure] AS Qrt_1_Disclosure, [Qtr 2 Disclosure] AS Qrt_2_Disclosure,
[Qtr 3 Disclosure] AS Qrt_3_Disclosure, [Qtr 4 Disclosure] AS Qrt_4_Disclosure, [Annual Disclosure] AS Annual_Disclosure"
vArea = Context.Items("Area")
vYear = Context.Items("Year")
vAggLevel = Context.Items("AggLevel")
vIndustry = Context.Items("Industry")
vOwnership = Context.Items("Ownership")
strQuery = strQuery & ", [Qrt 1 Establishments] AS Qrt_1_Establishments, [Qtr 2 Establishments] AS Qtr_2_Establishments, [Qtr 3 Establishments] AS Qtr_3_Establishments, [Qtr 4 Establishments] AS Qtr_4_Establishments"
strQuery = strQuery & ", [Annual Establishments] AS Annual_Establishments"
strQuery = strQuery & ", [Jan], [Feb], [Mar], [April], [May], [June], [July], [Aug], [Sept], [Oct], [Nov], [Dec]"
strQuery = strQuery & ", [Annual Avg Emp] AS Annual_Avg_Emp"
strQuery = strQuery & ", [Qrt 1 Wages] AS Qrt_1_Wages, [Qrt 1 Taxable] AS Qrt_1_Taxable, [Qrt 1 Avg wk wage] AS Qrt_1_Avg_wk_wage, [Qtr 2 Wages] AS Qtr_2_Wages, [Qtr 2 Taxable] AS Qtr_2_Taxable, [Qtr 2 Avg wk wage] AS Qtr_2_Avg_wk_wage, [Qtr 3 Wages]
AS Qtr_3_Wages, [Qtr 3 Taxable] AS Qtr_3_Taxable, [Qtr 3 Avg wk wage] AS Qtr_3_Avg_wk_wage, [Qtr 4 Wages] AS Qtr_4_Wages, [Qtr 4 Taxable] AS Qtr_4_Taxable, [Qtr 4 Avg wk wage] AS Qtr_4_Avg_wk_wage"
strQuery = strQuery & ", [Total Annual Wages] AS Total_Annual_Wages, [Taxable Annual] AS Taxable_Annual, [Avg wk wage] AS Avg_wk_wage, [Avg Annual Pay] AS Avg_Annual_Pay"
strQuery = strQuery & " FROM [vQCEWHIST]"
CreateNewBoundField("Qrt_1_Disclosure", "Qrt_1 Disclosure", False)
CreateNewBoundField("Qrt_2_Disclosure", "Qrt_2 Disclosure", False)
CreateNewBoundField("Qrt_3_Disclosure", "Qrt_3 Disclosure", False)
CreateNewBoundField("Qrt_4_Disclosure", "Qrt_4 Disclosure", False)
CreateNewBoundField("Annual_Disclosure", "Annual Disclosure", False)

Because of the mis spell Qrt, so i change it to Qtr.

CreateNewBoundField("Qrt_1_Disclosure", "Qtr_1 Disclosure", False)
CreateNewBoundField("Qrt_2_Disclosure", "Qtr_2 Disclosure", False)
CreateNewBoundField("Qrt_3_Disclosure", "Qtr_3 Disclosure", False)
CreateNewBoundField("Qrt_4_Disclosure", "Qtr_4 Disclosure", False)
CreateNewBoundField("Annual_Disclosure", "Annual Disclosure", False)

After i changed it, when going to SQL server express, looking at the original table, some how most of the data were changed to 0 and 1, some of them still stay the same, but most of it has been changed to 0 or 1.

View 3 Replies

DataSource Controls :: Inserting Data Into A SQL Table?

Jan 19, 2010

I am building an app (ASP.NET 3.5 + SQL 2005) that allow users to schedule meetings and these meeting will show in the users to-do list.

One kind of meeting, when scheduled, should show into ALL users to-do list.

I have 3 tables:

#1 - Users -> UserID
#2 - Meetings -> MeetingID
#3 - Member_Meeting -> UserID+MeetingID

What I need is:

Based on the scheduled meeting, read all users from table #1 and add their info in the table # 3 with the MeetingID (which I can get from the UI, because it will happen when they create the meeting).

I have been browsing about it, but so far, I couldn't find a good source of info to start with.

View 5 Replies

DataSource Controls :: Getting Data From One Table And Inserting It Into Another?

Jan 26, 2010

I have two tables cust and order_cust cust table have cust_id, name, addr, zip columns and order_cust have order_id and cust_id columns I take input from user for cust table i.e. name, addr, zip... the cust_id is an IDENTITY column so generates the value automatically Now I want to insert the last generated cust_id into order_cust (order_id is also an IDENTITY column)

How can I achieve that using stored procedure?

View 5 Replies

DataSource Controls :: Migrating Data From One Table To Another?

May 20, 2010

I am working on a tool which migrates all the data from one table to another table.there r three column in the 1st table which has say

ref_no s_id whoami

12,34,56,68 7,8,4,2 p,p,s,a

now iam supposed to put this data into 2nd table like this

r_id sno whoami

12 7 p

34 8 p

56 4 s

68 2 a

i was thinking of using split method and using looping .

View 1 Replies

DataSource Controls :: Loading New Row To Data Table

Jan 6, 2010

I am using 2 data tables one for comparing the i.item-id=dr[datacolumn] and one for storing the result i.item_guid,i.item_description_title. But getting an error at table2.Rows.Add(itemlist) {"Input array is longer than the number of columns in this table."}

DataTable table2 = new DataTable();
foreach (DataRow dr in ds.Rows)
{
foreach (DataColumn dataColumn in ds.Columns)
{
pfDataContext pf = new pFDataContext();
var itemlist = from i in pf.item_tbls where i.item_id == dr[dataColumn].ToString() select new { i.item_guid, i.item_description_title };
table2.Rows.Add(itemlist);
}
}

View 2 Replies

DataSource Controls :: To Select Data From A Table?

Mar 8, 2010

In anyway, is it possible to select data from a table, in such a way?

[code]...

View 4 Replies

DataSource Controls :: Inserting Data Into The Table Using Dataset?

Apr 23, 2010

I am having trouble inserting data into the table using dataset..following is my code:

[Code]....

The m_id is a primary key..I want to auto-increament it everytime a data is inserted into the table so I have configured (isIdentity) to Yes and Identity increament to "YES"..I don't know if its right or not..I already added some data manually into the table but now I want to add more data using the above code..but its not working..

[code]....

View 10 Replies

DataSource Controls :: Web Page To Display Data From A Table?

Apr 19, 2010

i want my web page to display data from a table, but instead of the "id" fields displayed, i want to display more meaningful field names. these are stored in other tables. my select statement is as follows:

SELECT [tblRelationship].[individual_id_1], [tblRelationship].[individual_id_2],
[tblRelationship].[relationship_type_id], [tblRelationship].[relationship_id],
[tblRelationship_Type].[relationship_type_id],
[tblRelationship_Type].[relationship_type_description],
[tblIndividual].[first_name], [tblIndividual].[individual_id] FROM
[code]...

View 12 Replies

DataSource Controls :: Unable To Delete Data In The Third Table.

Mar 18, 2010

I have three tables:

Colour(Colour ID, Colour)
DogColours(ColourID, Dog ID)
Dog(Dog ID, Breed)

Colour ID and Dog are primary keys.

I have three web forms, one for each table. Dog colours consists of data that is already in the system from the other two tables. It basically joins a breed to a colour. My problem is this:

When i try delete a dog which is being used in dog colours the program crashes. How can i prevent this crash?

The second problem, the data source in the dog colours web form has the insert, update and delete tick boxes greyed out in the 'configure the select statement' so i am unable to delete a colour and dog joined together. how can i delete something in the dog colours?

View 13 Replies

DataSource Controls :: Trying To Filter Out Data That Is Being Pulled From Sql Table

May 17, 2010

I have a form that has dropdown box and user can either select Store Associate or Store Manager, when they click on either, I have GetASsociate function that pulls data from sql database. What i am trying to figure out how to do, is that if they say select Store Manager I want to filter what data to pull from that sql table that has all associates in it, so I was trying use an 'expression' statement to stay if Store Manager was selected, only pull me back the store managers from that table. Then same thing for if they selected STore Assoicate, then only bring me back teh store assocites from that table. But the expression statment does not appear to be working.

asxc.vb code behind
Private
Sub GetDataAssociates()Dim provider
As DbDataProvider' Create a collection of parameters.
Dim coll
As
New DbParameterCollection()
Dim prmCompany
As
New DbParameter
provider = DbDataProviderFactory.GetProvider(DataAccessLayer.Enumerations.ProviderType.SqlClient,
"GetAssociatesByCompany")
prmCompany.ParameterName = "@Company"
prmCompany.DbType = DbType.Int32
Select
Case ddlCompany.SelectedItem.Text.ToStringCase
"Stores"
prmCompany.Value = 100
Case
"Corporate"
prmCompany.Value = 300
Case
"Executives"
prmCompany.Value = 900
Case
"Union"
prmCompany.Value = 200
Case
Else
prmCompany.Value = 0
End
Select
coll.Add(prmCompany.ParameterName, prmCompany)
Select
Case
Me.ddlOrganisationStructure.SelectedValue.Trim
Case
"StoreManagers"
Dim expression
As
String
expression =
"Pos_Group >'0900'"
dsAssociates.Merge(provider.GetData(coll).Tables(0).Select(expression)) --IS ERRORING OUT ON ME HERE AT THIS LINE
dsAssociates.Merge(provider.GetData(coll))
dtAssociates = dsAssociates.Tables(0)
Case
"StoreAssociates"
Dim expression
As
String
expression =
"pos_group < '0900'
dsAssociates.Merge(provider.GetData(coll).Tables(0).Select(expression)) -IS ERRORING OUT ON ME HERE AT THIS LINE
dtAssociates = dsAssociates.Tables(0)
End
Select

View 4 Replies

DataSource Controls :: How To Amend Existing Data In A Table

Feb 26, 2010

i want to amend existing data in a table with new data how to do it in sql??

Ex:i want to amend name called john to peter how to do it??

View 4 Replies

DataSource Controls :: Retrieve Data From The Last Record Of A Table?

Jul 7, 2010

I want to retrieve the data from the last record of a table. For eg: I have sorted the data in my table and want the value from the last record? How can I do that?

Is there a way to check that "saving" data to a table was successful and then do something after that?

View 1 Replies

DataSource Controls :: Unable To Upload Xml Data To Table?

May 10, 2010

i am trying to upload excel sheet data to table which contains xml data type. one of the record in excel sheet contains xml data like below.

<location><locid>1</locid><locid>2</locid><locid>3</locid><locid>4</locid><locid>5</locid><locid>6</locid><locid>7</locid><locid>8</locid><locid>9</locid><locid>10</locid><locid>11</locid><locid>12</locid><locid>13</locid><locid>14</locid><locid>15</locid><locid>16</locid><locid>17</locid><locid>18</locid><locid>19</locid><locid>20</locid><locid>21</locid></location>

because of this length or some else...i am unable to upload excel sheet to table.

View 1 Replies

DataSource Controls :: Correct Calculation For Avg If One Table Has No Data?

Mar 24, 2010

I currently have 3 tables and return an average value for the OverallRating Column on each to get a CombinedOverall, but what if one of the tables does not have data for a particular customer? if I divide by 3 the answer will not be the same, and I could get an answer that is over the max I want (5.0)

[Code]....

It will be possible that the Customer will not have any data in one of the tables.

How do I get around this?

View 10 Replies

DataSource Controls :: Create A Simple Page Which Allows A User To Post Data Into A Data Table?

Jun 21, 2010

I want to do is create a simple page which allows a user to post data into a data table. It should not allow them to view, update or delete any data.

Is there a good online tutorial which would guide me through how to do this in Visual web developer 2008?

I have connected a db, and can add "SELECT" controls to view forms, but I need to be able to INSERT to the table.

View 4 Replies

DataSource Controls :: Select A Record From A Table And Insert Into B Table Using Linq?

Jun 29, 2010

how can i select a record from A table and insert into B table using linq?

View 2 Replies

DataSource Controls :: How To Fetch Data From Temp Table In Sql Server

May 4, 2010

i want fetch data from temp table in sql server stored procedur like below code

[Code]....

primary key is of uniqueidentifier in dataTable

View 4 Replies

DataSource Controls :: How To Use A Data Table As A SQLDataSource Control Source

Aug 4, 2010

I know this sounds odd. I have a SQL DB that I am pulling data from. I have to some math functions to get a percentage. So I am pulling all the data in my code and building a data table with the results. I am then trying to pass this into a chart control that I have, but it fails because the data source is not correct for the chart control. I know that the chart control will accept a SQLDataSource control as a data source because a built a example with it before using it in my project.So my question is how can I use the Data Table as a data source for a SQLDataSource Control? Or is there a way I can pull the data from my DB andapply the math needed in a stored procedure or something similar that I could create the procedure on my SQL server then add a SQLDataSource control to my page and use the stored procedure as the source for the SQLDataSource Control.

View 5 Replies

DataSource Controls ::to Find The Tableadapeter To Add Data To Database Table?

Feb 27, 2010

where can i find the tableadapeter to add data to my database table? and is that the best way or there a easier way... i have a csv file that i would like to add to my data table but i don't know how?

View 1 Replies

DataSource Controls :: Store Data From XML File To Table In Database?

May 14, 2010

I am trying to store data from an XML file to a table in my database, but I keep getting the same error.

This is my code from the cs file:

[Code]....

And this is my error:

Violation of PRIMARY KEY constraint 'PK_Areas'. Cannot insert duplicate key in object 'dbo.Areas'.

The statement has been terminated.

In my XML file I have both existing rows and new rows for the database table. I'm guessing I have to do something to sort out the the rows that are not already in the database, but so far I have been unsuccessful to figure this out.

View 1 Replies







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