Access To Fields In A Table
Jun 25, 2006I am trying to access the fields in a table using Visual Basic in Web Developer .NET
View 1 RepliesI am trying to access the fields in a table using Visual Basic in Web Developer .NET
View 1 RepliesHi
I'm all very new to SQL Reporting Services so I am hoping that someone will be able to help me.
I have two datsets. Both contain the same array of information pertaining to a particular site. For example, how much sales we had, how much revenue was made, how much commission was created at the end of each day, the usual kind of metrics. We have a stored procedure which takes a final total and puts into a table we can access by date.
I want to produce a report that can compare the data from two dates. I use two datasets to run the quries that will return the relevant data. The only thing that differs between the dataset is the date that the data is based on. So to say first dataset will have data on one date and the second dataset will have data on a another date.
I was trying to make a table where I could include fields from both datasets, mainly for making comparison easier.
so id have
columns
online hits (dateone) | online hits (datetwo)
Rows
Data date1 | Data date2
and so on.
in fact i had this as the data from the first dataset in an example field:
=Fields!OnlineSales.Value
but i couldnt get the second dataset to work even if i tried entering :
=(Fields!OfflineBookings.Value, "SecondDatePicker")
I can't get the table to include field results from the second dataset as a table can only be linked to one dataset.
How can I get round this little problem?
How can I create a Table whose one field will be 'tableid INT IDENTITY(1,1)' and other fields will be the fields from the table "ashu".
can this be possible in SQL Server without explicitly writing the"ashu" table's fields name.
I have a list of items in one table and a field (pageName) in another table that may contain one of the aforementioned items somewhere within that field. There is no fixed position within the field where the itemNo may be so I can't just use SUBSTRING(pageName,2,5) in(select itemNo from tblItem).
Logically, it's like I need to combine IN and LIKE: select pageName where pageName LIKE IN %select itemNo from tblitemNo%..LIKE can only handle one comparison string.
I have an access database that I am about to move over to SQL Server. In there I have member table that has a memo field. This table has the potential to grow quite big. My question is: what issues does having a large text field have on my database. Will it slow down my updates, searches or inserts? I plan on using this field for such things like a biography of the member. Is using a text field the best way to go, or should I look at text files instead? Many thanks,
View 1 Replies View RelatedI have an MS Access database that has 140 fields.
Every 4 fields are the same repeating pattern of types Memo, Number, Number, Currency. (e.g. Q1 - Memo, Q2 - Number, Q3 - Number, Q4 - Currency, Q5 - Memo ,etc. . . )
I need to query this and combine them into 4 columns. Do a group by on the 2nd field and calculate average on the fourth.
Is there any way to do this with queries? The fields were named in sequential order from Q1 - Q140.
This database isn't my fault, but unfortunately, I need to work with it.
I have <asp:SqlDataSource> in aspx page that is being used by an updateable GridView. However, there are a couple fields in the dataset that contain filenames that I want to access directly in code and place them into some image tags on the page. This line should give me access to the dataset but how to I access the fields?
Dim myDataSource As DataView = DirectCast(SqlDataSourceGridView.[Select](DataSourceSelectArguments.Empty), DataView)
When the SqlDataSource is a DataReader I would access it with the code below but since this SqlDataSource is a DataSet I can't access it with this code.If myDataSource.Read Then If Convert.IsDBNull(myDataSource("CusAgentPhoto")) Then ImageAgent.ImageUrl = "/photos/nophoto.gif" Else ImageAgent.ImageUrl = AgentImagePath & myDataSource("CusAgentPhoto").ToString End If If Convert.IsDBNull(myDataSource("CusCompanyLogo")) Then ImageCompany.ImageUrl = "/photos/nophoto.gif" Else ImageCompany.ImageUrl = OfficeImagePath & myDataSource("CusCompanyLogo").ToString End IfEnd If What would be the correct way to get at the DataSet fields that contain the filenames?
I'm in the process of converting over an Access database - The existing Forms, Reports, etc are staying within the Access front-end and the Tables are now linked to the SQL database. The only problem is, most of the Tables contain Autonumber fields, so although they converted over to Identity fields, existing records work fine. When I try to add a new record, it doesn't automatically enter the next available Autonumber/Identity until I select a record which already exists to force it to update itself. When I add a new record using the original Access database, as soon as you start entering information into the new record, the next available Autonumber automatically appears. Any suggestions on forcing it to automatically appear using the SQL database and an Access form????
View 4 Replies View RelatedI Apologize if this isn't the forum to ask this...
I have a MS Access (MDB) file with a table with 2 date fields, i want to read from a dialog on my app (on MS Visual .NET Studio 2005), here's the code I've been using do far:
Code Snippet
hr=theApp.m_cs.Open(theApp.m_ds);
if(SUCCEEDED(hr)) {
theApp.m_cs.StartTransaction();
theApp.m_cs.Commit();
CCommand< CDynamicAccessor > cmd;
CComBSTR query(_T("SELECT NumContrato, NumClie, FechaC, FechaCob, Inversion, NoCobrador, NoVendedor, Total, Plazo, Pagos FROM Contrato"));
CString string(query.m_str);
cmd.Open(theApp.m_cs,string);
hr = cmd.MoveFirst();
query=static_cast< BSTR >(cmd.GetValue(1));
CString csres(query.m_str);
this->m_numc=(int)*(query.m_str);
query=static_cast< BSTR >(cmd.GetValue(2));
m_numcte=(int)*(query.m_str);
query=static_cast< BSTR >(cmd.GetValue(3));
//m_fecc=(int)*(query.m_str);
MessageBox(csres);
theApp.m_cs.Close();
}
FechaC, FechaCob, are the two Dates I want to retrieve, but when I debug, it reads a 0 (zero) from the date fields, is there a limitation? can they be read? is there a special way to read them?
> thanks in advance!
-----
Me!
I have a whole bunch of forms that have an unbound StartDate and anEndDate field that I have used in MSAccess MDB databases as parametersin queries (ie tblEvent.StartDate > Forms!myFormName.StartDate.)So, now I'm migrating this beast over to and ADP/SQL Server projectusing Views and Procedures.How do I pass the value in Forms!myFormName.StartDate to a Procedureand get something that looks like:If tblEvent.StartDate > Forms!myFormName.StartDate then ...Any help is GREATLY appreciated. This is a major problem before I canmove ahead with this beast!lq
View 1 Replies View RelatedI have a test query that i have ordered by the expected result order.
select t from (
select cast('1' as nvarchar(20)) as t
union all select '1---qa'
union all select '1q'
union all select '1q1'
union all select '1qz'
[Code] ....
and the question is... why is minus character (at 3rd line in '1---qa' string) ignored by "order by" clause? That row is put after '1q1' and not after '1'.
When you replace '-' with '+' or any other special char it works as expected but not with '-'. It is just ignored no matter if there is one or more of them.
Don't mind local chars like čž, they are for testing purposes with collate (thus commented) and with bin collation that is not doing proper sorting but minus order is ok in that case.
Tested on SQL 2008 R2 and SQL express 2012, database collation is 'Croatian_CI_AS'.
Hello all,I'm a total newbie with SQL Server 2000 and I have a little problem whenmoving a database form Access 2000 to SQL Server 2000.In the Access database, each table has an auto-increment field.After importing the tables in SQL Server, all the auto-increment fieldsare turned into "int" type fields.Does anybody have an explanation for that mystery?Thanks in advance,Yan
View 3 Replies View Related
I have 2 tables with 2 fields in common between them. How do I get a count of rows in table 1 but not in table 2 matching those 2 fields? Thanks.
Hello all:
Is it possible to creates fields of the table dynamically?. I have this situation in my project. This is just a small sample. I have row of length 140. I don't wan't to declare all this fields manually using the create table command.
The description of table is as, in this table all the field are of type varchar only, there are like 140 columns.
create dummy emp (
field1 VARCHAR(100), field2 varchar(200), field3 VARCHAR(100).... )
Table: Dummy
================================================== ==
field1 field2 field3..........
Empid Empname empaage1 sam 23...........
2 rai 22............
.
.
.
n raj 45.............
================================================== ==
Now I want to create another table as "EMP" , with proper data type
fields too..
create table emp (
empid int, empname varchar(100), empage int....)
The table should look like as:
Table: EMP
================================================== ==
Empid Empname empaage............
1 sam 23...............
2 rai 22................
.
.
.
n raj 45.................
================================================== ==
I want to do this dynamically.....
Some how I need to extract those field from table[dummy]; the first row acts as a column header for the table[Emp] and the subsequent row acts as a record for the table[Emp]
A small rough snippet of the code will be appreciated....
Waiting for replies........
saby
I want to update my Table but it has 30 fields so how can i modify my table i have to add some fields in it
I need that query for alter table
in it
reply me soon
All- Supposing I have table_a and table_b. Table_a has fields FIRST_A and LAST_A for people's first and last names. Similarly, table_b has FIRST_B and LAST_B for people's first and last names.
How would I create a record in table_b for each record in table_a, such that for each added record, the values of FIRST_A is copied to FIRST_B and LAST_A is copied to LAST_B. (Table_b will have other fields that are left unfilled.)
Thanks!
-Kurt
Access Connection
create a new Connection Manager by right-clicking in the Connection Managers section of the design area of the screen. Select New OLE DB Connection to bring up the Configure OLE DB Connection Manager dialog box. Click New to open the Connection Manager. In the Provider drop-down list, choose the Microsoft Jet 4.0 OLE DB Provider and click OK.
Browse to the Access database file and connection set up---all good!!!
Dataflow task
Add an OLE DB Source component
Double-click the icon to open the OLE DB Source Editor. Set the OLE DB Connection Manager property to the Connection Manager that I created . Select Table from the Data Access Mode drop-down list.
I cannot see the tables set up as set up as pass-through table types to a Oracle 9i db
Any ideas please help
thanks in advance
Dave
Hi Everyone,
I have set up a link from ACCESS to a SQL 7.0 database using ODBC (File DSN saved on a shared DRIVE). The link works well only from the workstation where the link was created. But How can I create a link so a group of users can view the linked table in ACCESS without type a password? Any suggestion is appreciated.
Lunjun
Is there a way to specify a MS Access table (or query object) in the select query of SQL Server.
Ex.:
MSAccessTable (in file.mdb)
col1
col2
a1
a2
b1
b2
SQL query in SQL Server:
SELECT col1, col2 into SqlTable from [file.mdb].MSAccessTable;
Thanks,
I want to let a user a fields and select the data type and size from a short list. For example: nvarchar(?), Money, Int, or Bit. These are most likely the only choices for now. There will be a web page that lets them enter a field name and select a data type.
Can someone suggest how the sproc might look? Here is what I have so far.
CREATE PROCEDURE [dbo].AddCustomField ASALTER TABLE MyDataSQL.dbo.tblCustomFields ADD @FieldName @FieldDataType NULLGO
Thank you,
I want to put fields from four tables into one table. I created a new table, but how do i get the same fields from the other tables to this table along with primary and foreign keys.
Table Fields
Tbl_Date_Dimension [Date_Dimension_Year], [Date_Dimension_Period], [Date_Dimension_Fiscal_Week]
Tbl_Report_Level Report_Level_Id
Tbl_Customer Customer_Code
[Sales Fact] [Gross Turnover] , Quantity, Consolidated_Sales_Tables_Id
The new table is called Tbl_Sales_Growth
Here's the information on the new table:
Code Block
[Date_Dimension_Year] [int] NOT NULL,
[Date_Dimension_Period] [int] NOT NULL,
[Date_Dimension_Fiscal_Week] [int] NULL,
[Report_Level_Id] [int] NOT NULL,
[Customer_code] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Consolidated_Sales_Tables_Id] [tinyint] NOT NULL,
[Quantity] [decimal](18, 0) NOT NULL,
[Gross turnover] [decimal](18, 0) NOT NULL
) ON [PRIMARY]
I need to get the field values of a table (name will be dynamic).Then assign those values to properties in a class.Let's say I will get the table name dynamically.dim tblName as string = "tablea"The 2 tables can each have 25 fields or so.I need a way to select the amt and email field values from tblName. Without saying "select job_amt, job_email from ...Is there someway to get the values based on the column name. So if the column name has amt and email, then give me those values.Maybe loop through the datatable - then for each column -- if col.ColumnName.IndexOf("Amt") = 0 or col.ColumnName.IndexOf("email") = 0 thenthen drop that column from the datatable.ex of table structure<u>tablea</u>job_idjob_amtjob_email<u>tableb</u>dance_idamt_dancedance_email
View 3 Replies View RelatedMy users login from the tbl_users table.
I would like to store all information on them in this table but that amounts to quite a lot of fields (about 50) and some of these will store a lot of HTML text in them.
Is it best to split the table up for performance reasons or will it make little difference?
Thanks,
JB
Hello all,
How can i write a sql statement that can give me the name of the fileds in a specified table.
Eg: if i have a table name "table1" , which has the fields "field1", "field2",........ How can i get these fields names using sql query.
any help.
I'm new to SQL Server 7. Is there a limit to the number of fields that a table can have?
View 1 Replies View RelatedI have maked this little code but dont know the way to insertt new table and fileds in database DATABASE01...
Private Sub Command1_Click()
Dim objConn As ADODB.Connection
Set objConn = New ADODB.Connection
objConn.ConnectionString = "driver={SQL Server};server=DVD377-14D9E48CSQLEXPRESS;uid=;pwd=;database=master"
objConn.Open
objConn.Execute "CREATE DATABASE DATABASE01"
''''''''''''''''''
'"CREATE table Mytable"
''''''''''''''''''
''''''''''''''''''
'"CREATE filed1" in text format
'"CREATE filed2" in text format
'"CREATE filed3" in text format
'"CREATE filed4" in date format(DD/MM/YYYY)
''''''''''''''''''
objConn.Close
End Sub
I am new to SQL Server 2005 and I am trying to add two fields to an existing table. The table has 15 Million records in it and the save is not completing. How do I add the new fields?
View 14 Replies View RelatedI have two name columns in my table, NAME1 & NAME2 that I want to compare to see if they match. Only problem is that the order of the first, last, middle name can be either same or different between the two fields.
For example
NAME1 = JAY JOHN SMITH
NAME2 = JOHN SMITH JAY or SMITH JOHN JAY
Is there a way to somehow reorder these fields and then compare using SQL?
Hi,
I am new to sql and is working with sql server managment 2005 +c# 2005.
My application needs to create a blockdiagram sort of thing say
if in my database i got a table 'Addition' with 'a', 'b', 'c',and the primary key addition_id, and c is related to a and b as c = a+ b.
there is stored procedure name usp_addition which contains this relation. Each time any insert or update is done this sp is executed and all the values are updated for accordingly.
My problem starts in the front end where i need to draw the graphical representation of table addition.
In this graphical representation, I need to draw the labels a, b, c and the arrows from a and b which will connect to c, showing that c has a, b as inputs.
I got the label using dataset and datacolumns but hte problem is how to create the arrows the name of labels (i.e my column names from which the arrow should start and end)
How does I get the information that c as two inputs a, b. I dont need the values since i just want to view the columns in table and which column is input to another column.
Since I need to do this dynamically because my tablename, and the number and name of column would differ does any body knows how to do this.
Priyadarshini
I'm kind of new to SQL and would appreciate some help with this. I have a table named Company. In this table there are fields called CompanyID, CompanyName, Address, and Year. (There are other fields too, but they are not relevant for this post.) There are multiple companies in the table and each company has a unique ID number. However, each company can have up to three records in the table. (One for the year 2005, one for the year 2006, and one for the year 2007.) Currently, only a company's 2007 record has data for the address. It's 2005 and 2006 records have addresses that are blank. I want to be able to update the 2005 and 2006 records with address from the 2007 record. Obviously, a very simple update won't work because there are multiple companies and multiple records that need updating. Can anyone fill me in on the SQL statement(s) I would need to make this happen? I would be extremely appreciative.
View 5 Replies View RelatedHello to all,
i want to make a table in order to keep the data of a hard disk.
e.g. create table disk{
capacity integer,
name varchar(50),
ports integer,
buffer char(1));
For example i want this hard disk to have these fields and i would like from the user to type me only the capacity because it is going to be a required field and the other fields(name,ports,buffer) to be optional!
How do i declare optional fields in a create table command?
and then how do i declare/define these fields in insert too?
Thanks, in advance!
Hello,I would like to create a stored procedure that would compare the fieldsof two tables and their types. If they are different the user iswarned.How can I do that ?thx
View 3 Replies View RelatedI have a table that display large amounts of text in some fields. The table only has two columns (Field Name and Field Data). If the Field data is too large to fit on the same page as the field above it, it pushes to the next page, and then starts printing at the top of that page (the next page down).
I tried setting the "Keep Together" property of the table = True, but this was of no use.
Has anyone found a way to work around this, and if so could you let me know what you had to do. It may just be a SQL Server default setting that cannot be changed. I just want to research all possibilities before reporting back to the users.
Thank you,
T.J.