A Sql Question About 2 Tables ==> Report

Feb 26, 2000

I have a question about 2 tables like:

table1
UserID UserName
01name1
02name2
03name3
04name4

table2
UserID VisitDate
023/10/1999
0422/9/1999
0222/9/1999
0310/9/1999

I want to use one sql statement to produce the following report:

UserID UserName Visit_Num
01name10
02name22
03name31
04name41

(just count how many times the user visited,if not put 0 ,but must has all UserID and UserName)

how can I do that?
thank you

View 1 Replies


ADVERTISEMENT

Reporting Services :: SSRS Report Export In Excel To 2 Pages Where Have 2 Tables In Report

Sep 21, 2015

I have a ssrs report having 2 tables in with 4 columns in each. When I go to export option in preview I can see all data coming in one excel sheet, But I am trying to get 2 tables in 2 different pages in Excel when I export.First page of excel comes with first table data with 4 columns and second page of excel comes with second table data with 4 columns .

View 2 Replies View Related

Multiple 1:N Tables In Single Report Builder Report

May 31, 2007

The version of Report Builder I have will only let me choose from a very limited range of layouts. For example, the tabular layout displays a single table on a page.



Is there a way to produce a report containing two tables and other fields?



For example, I would like to create a very simple customer report with customer name and address at the top, then a table containing all contacts I have for the the customer (a 1:N sub-table of customer) and then a second table containing all the orders from the customer (a 1:N sub-table of customer).



Is this possible in the current version of Report Builder or is it planned in a future relase?



P.S. I know this is easy in VS Report Designer but I specifically want to do this in Report Builder. The Report Designer client is simply too complex for my non-technical user base. Report Builder would be ideal.

View 3 Replies View Related

Report From 2 Tables

May 24, 2007

Hi Guys,

I am trying to build a report that will present data from 2 sql tables. Here is the scenario:



I have 2 Tbales:

1. TimeSlots - has SlotID and Time columns

2. Reserv - has SlotID, Name, Comments, Date



I am trying to build a report that will show all SlotID's from TimeSlots for a certain Day. The report should show all Time slots regardles if there is a reservation for that TimeSlot, also the Name and Comments for the Time Slot that is reserved.

The idea is that if a time slot is not reserved it should still print on the report which will then be given to the user who will manually pencil in the data should a pop up reservation occurs.



For Example:



SlotID Time Name Comments

1 6:00

2 6:15 Sven Employee

3 7:00 Randy Employee

4 7:15



Please help as i am lost!



regards

SD

View 3 Replies View Related

Pre-Populating Report Tables

Nov 28, 2007

Hi. I have a report which has several datasources which require a table to be populated before they read from it.
i.e. The first thing that needs to happen whenever the report is run, is a call to a stored procedure which populates the table the report datasources are based off of. The SP takes several minutes to complete and MUST complete before any of the datasources fetch their data.

How can this be achieved?

I can not find anything in the Visual Studio Report Designer which allows to me to instruct Datasource B to not execute before Datasource A has completed (or any other way to call a data population SP, before the data reader SP's execute).

Thanks.

View 2 Replies View Related

Calculating Between 2 Tables In One Report

Jan 19, 2007

Goodmorning,

In one report I have 2 tables. Both tables are related to a different data set. Now I want to create a calculating between a field of the table 1 and a field of table 2.

Does anyone know how to?

Thx anyway!

View 6 Replies View Related

Hiding Tables In A Report

May 6, 2007

Hi,



Can anyone help me with the expression I need to use in order to hide a table with no rows? I have put my table inside a rectangle with the idea that I would just hide the rectangle if there weren't any rows but I can't find any examples of what expression I can use to specify the no rows condition.



Thanks!

Debi

View 5 Replies View Related

Count From Multiple Tables In A Single Report

Sep 11, 2014

how to count from multiple tables. So currently I pull two separate reports to show the count of TaskIDs by customer state and another to show WrapID by Customer state for last month:

TaskID Count by Customer state Query:
---------------------------------------
SELECT CU.CustomerState as 'State'
,Count (CM.TaskID) as 'CaseCount'
From Customer CU
LEFT OUTER JOIN ACN_CCPCaseManagementTask CM ON CU.CustID=CM.CustID

[code]...

I am wanting to add both these counts into a single report so i tried the follow query but the counts don't match to the reports I pull separately.

SELECT CU.CustomerState as 'State'
,Count (CM.TaskID) as 'CaseCount'
,Count (CW.WrapCodeID) as 'WrapCount'
From Customer CU
LEFT OUTER JOIN ACN_CCPCaseManagementTask CM ON CU.CustID=CM.CustID
LEFT OUTER JOIN acn_ccpwrapcode

[code]....

View 2 Replies View Related

Cursor To Compare/report On The Same Fields In 2 Tables

Sep 20, 2006

I have the following cursor that I am comparing 2 tables, theproduction table and a copy of the production table, I want results ofall address's that are like the address1 field...the problem is...myresults are giving me every field and if there is more than one, it isputting it in a grid....I only want to see results if they are 1 for the same address fieldthis is what I have so far....declare @address1 char(61),@city char(61)declare address_cursor CURSOR FORSELECT address1,city FROM test.dbo.testaddOPEN address_cursorfetch next from address_cursor into @address1,@citywhile @@fetch_status = 0BEGINselect * from testadd where @address1 like '%' + address1 + '%' and@city = cityFetch next from address_cursor into @address1,@cityPrintENDCLOSE address_cursorDEallocate address_cursor

View 4 Replies View Related

Fixed Header Not Possible On Multiple Tables In Same Report?

Feb 19, 2008

I have 2 tables in a report and have set the FixedHeader property of the 3 left columns on both tables to True.
The report displays perfectly when previewing, but when deployed and viewed in IE6 fixes only the columns from the first table
(all columns from 2nd table display, but the 3 columns with FixedHeader set to true scroll out of view when report is scrolled right)
and additionally displays an error.

Error:
Line: 13
Char: 1080
Error: 'children.0.children.0.children.1.children' is null or not an object
Code: 0
URL : <URL of report displayed here>

Possible additional points of interest.
1)There are some groupings in the second table which are initially hidden and toggled by cells in the 1st or 2nd column of the table.These 2 columns are the first 2 of the 3 columns having FixedHeader set to True.
2)If the 1st table is moved physically to below the 2nd table, FixedHeader fails on both tables.

Is there something that I've set up incorrectly?
Any help is appreciated.

View 2 Replies View Related

Should Be A Simple Question About Related Tables In A Report.

Jun 18, 2007

Experienced memebers,



I have what should be simple question about related tables in a dataset and using those fields in a report. Here is my simple design.



Order Header -> Line Item -> Line Discount -> Discount Table



Now when designing this report I cannot seem to access the related discount records for the line item. (as more than one can be applied) Every time I try to drag an field from one of the tables in the dataset to my report it automatically adds "First()" onto the field value expression. This seems to work fine for the order header, but doen't even come close to getting the right discount on the line item? I basically need to pass through the Line Discount table to get to the discount name field to put on the same line as my line item data on the report.



I have looked and googled for for an example on this, but have come up short. Can anyone point me in the right direction?



Thanks,



Chris

View 5 Replies View Related

Payslip Report With Multiple Tables/datasets

Jan 14, 2008

A report I am currently working on is a payslip report.
This report has multiple tables on the page, each linked to their own specific dataset.
Eg I have Taxable Allowances table linked to a dataset that returns information relating to any taxable allowances for an employee, then Non-Taxable allowances, Deductions and so on...

Taxable allowance dataset example

SELECT
TA.TaxableTrDesc,
TA.TaxableTrText,
TA.TaxableSubQty,
TA.TaxableTrRate,
TA.TaxableTrFact,
TA.TaxableSubTtl
FROM
Employee E
INNER JOIN TransCurrentMaster TCM ON E.EmployeeCode = TCM.EmployeeCode
CROSS APPLY udfReportTaxableAllowances(E.EmployeeCode, TCM.PaySequence, ) TA
WHERE
E.EmployeeCode IN (@EmployeeCodeParameter)
AND TCM.PaySequence IN (@PaySequenceParameter)

The report works fine when you select one employee.
Currently when you try to select more than one employee, all the employee results are displayed in the tables, for example, Taxable Allowance table contains all taxable allowances records for all employees on the one page...
I'm not sure how I can amend this report so that it is able to be run for multiple employee records...
Any ideas, thoughts, feedback would be much appreciated..

Cheers

View 4 Replies View Related

Multiple Tables In A Report And Page Breaks

Sep 25, 2007

I have a report with 5-6 tables showing different summary information. These are set up to all go one after another and there are no page breaks. The only instance I would like a page break is if a table content is getting split cross pages. Is there a way for me to specify that a table will be on a new page if it is broken accross multiple pages?

(This is due to Row growth, not column growth)
(KeepTogether is set to true)

Any help is greatly appreciated.

View 3 Replies View Related

Locks The Tables While Running Report...Very Very Urgent....

Sep 11, 2007

Hi all ,

When i Run the report in reporting services, it locks the tables.
so is there any option to Unlock the tables. I m using just select query to run the report but when i run the report it locks the tables.

I used with(nolock) option in select query but it didnt work...still showing me lock on the tables.

Pls help...its urgent

Thanking You,
Rupali Rane.

View 2 Replies View Related

Summarized Report From One Table Based On Information From Other Tables

Dec 11, 2004

Hi,

These are my tables

auth:
id, level, base

info:
aid, name

store:
aid, itemID

aid is the ID that comes from the auth table.

The final output that I plan to get is

Name Number of Items

where name comes from the info table, and number of items comes from the store table.

Query something like:

show the total number of items for all those users (in the fashion Name, Number of items)from the store table, for all those whose level=something and base=something in the auth table.

For example,

if there are 10 users whom match level=something and base=something in the auth table,

What I want displayed is:
------------------------
Name Number of Items
------------------------
user1 10
user2 15
user3 20
....
user10 30
-----------------------

which if broken up is:
select name from info where aid=X
select count(*) from store where aid=X ..

for all those whose base=something and level=something from auth.


Thanks,
Shashi

View 1 Replies View Related

Report Generation Using A Single Dataset, Which Combines Two Tables.

Jan 18, 2008

Hi,

I have an issue in generating the report in sql reporting services. I need to display a report in a table format. The datas of the table should be from two different sql tables. I have tried to write a stored procedure that returns two result sets from two different tables. As reporting services takes datas only from the first result set, i tried to write two different stored procedures each displays one result set. Then i have created two datasets with that two different stored procedure. Even then i cannot proceed as i was not able to use two different dataset in a single table because i was setting the datasetname to one dataset, when i try to retrieve the fields from another dataset i was able to retrieve only first and count values. Then i tried using sub reports. As sub reports for a dataregion(table) repeats for every row of the main report i was not able to fetch the correct datas. Atlast i have tried combining the query using join and wrote a single stored procedure. This stored procedure returns a single result set retrieves data from two tables satisfying the conditions. The issue i am facing with this is, the first table has only one row satisfying the condition and the second table has three rows satisfying the same condition, as i am using join query for the three rows returned by the second table the first table datas are getting duplicated for the rest of the rows in the second table. As I found using join query is the only resolution for the output which I need, and also I have to avoid the duplication of the records. Hence let me know for any solutions.

I have shown the sample datas that is duplicating which is indicated as bold. Phonenumber, Attemptdate and calloutcome are from first table and start time and endtime is from second table. As there are three different datas for the second table, first table datas are duplicated





Phone Number

Attempt Date

Call OutCome

Start Time

End Time


843-577-0800

2007-09-10 15:20:00.000

Contact with Prospect - Expressed Interest

15:08

15:12


843-577-0800

2007-09-10 15:20:00.000

Contact with Prospect - Expressed Interest

15:25

15:25


843-577-0800

2007-09-10 15:20:00.000

Contact with Prospect - Expressed Interest

15:26

15:27

Thanks for any help in advance


Thanks,
Sangeethaa

View 3 Replies View Related

How To Construct The Url Via Database Tables Info To Generate Report

Aug 17, 2007



Please help, i am really really struggling for a logic to handle 100's of reports we have via button click from asp.net webform.
in the button click i am constructing the url :
**************************************************************************************************************
http://localhost/reportserver?/MyReports/StatusReport&UserID=1&ContractID=1&subcode=null
*************************************************************************************************************

I have a table would like to maintain the parameters required for the chosen report:
when the user chooses from list box on the webform for StatusReport, immedeately it fetches the parameters related to Statusreport and gets everything which is stored with a space in between for each parameter, for this report i have 3 parameters:
UserID ContractID subcode

now how can i construct the string based on the above parameters , i am using vb.net as code behind for my webform(asp.net)

please any ideas will help me achieve the logic. please help thank you all very much.


View 4 Replies View Related

Reporting Services :: Export SSRS Report With Multiple Tables To CSV

May 11, 2015

I have a report with 2 tablixes, both the tablixes can be hidden based on the parameter selection. The 1st tablix has a drill through action on one of the columns, that calls the 2nd tablix in the SAME report. Once you click on the drill through, the 1st tablix is no longer visible, only the 2nd one is.

The report is working fine, until you export it to CSV file. Once you are on the 2nd tablix (1st one is NOT visible at this time in the report), and then when you export it to CSV, BOTH, the 1st tablix as well as 2nd tablix are visible in the CSV file. Why does the 1st tablix come up in CSV IF you just exported 2nd tablix to CSV?

Is there a workaround to NOT show the parent/1st tablix at all if the 2nd tablix is exported? Excel works fine!I know sub-reports instead of multiple tablixes might solve this issue.

View 4 Replies View Related

How To Get A Data Bound Page Footer In SSRS In A Report Having Multiple Tables?

Feb 19, 2008

hello to all..

can someone tell me how I counld get a pagefooter linked textbox to show a data bound
page footer in a report having 8 tables....???
I have tried the common solution showed on the previous forums..
They worked when there was only one table...
where in i could place a group in 1 of the cells in the table body of the report.
but now since der are 8 tables in the report.. d job is become very tricky.

the page footer is not showing up on all the pages of the report.
it only shows on the first page of the report.

Plz help......

Regards
Savio.

View 1 Replies View Related

RDLC Newbie Questions (hopefully)...connecting Dataset To Report That Contains Multiple Data Tables

Sep 12, 2007

Hi All,

We are post-deployment with a serious reporting issue that's causing us to rethink our reporting solution. We're considering moving from what we have to SQL Server Reporting Services (client side).

I have spent the past couple of days getting up to speed on this feature and seeing if we can easily migrate it into our existing application. However, I've hit a couple of stumbling blocks and was hoping perhaps someone here could either tell me the solution or point me in the right direction.

I'm not having any problems creating basic reports (e.g. flat data).

However, I am having problems creating reports where there are related tables in a dataset.

The way it works with our existing solution is that I get a dataset (which contains several data tables) and point it to the report's datasource. That report expects those tables and I have defined table-relationships in the report which process and display the information correctly.

I'm not having as much luck with RDLC.

I can go into futher detail about how I'm creating the report, but let me just ask these general questions first:
1. Can I set a dataset containing multiple datatables equal to a property on an RDLC report and that RDLC report know how to treat and display the data?
2. Is there a better/smarter than this to get a field selection from my datasource (remember, this information is coming from a stored procedure so connecting directly to the database is not an option):
a. In code, populate dataset
b. In code, write dataset schema to xml (e.g. an xsd file)
c. In Visual Studio, add the XSD file to project
d. Use fields from XSD file to drag and drop fields on report

A fancy example would be nice too. I've googled like crazy the past couple of days and downloaded as many samples as I can find (including the ones on ftponline.com, gotreportviewer.com, "Tudor's WebLog", and several others). However, I have yet to find one that uses grouping and related datatables.

Thank you so much (if, for nothing else, reading this post )

View 4 Replies View Related

Power Pivot :: Creating A Summary Report Using Relationship Between Date Table And Two Fact Tables

Oct 19, 2015

I have below tables in my power pivot.Fact 1 & Fact 2 - connected directly to Mainframes - Data is from the same table broken up due to size of the data.Date Table - Relation ship between both the fact tables.How do i create a summary pivot to get the number of tasks that have been completed in each month.

Month   Count
July
August
September
October.

View 3 Replies View Related

This Feature Remote Access To Report Data Sources And/or The Report Server Database Is Not Supported In This Edition Of Report

Jun 16, 2006

SQL server 2005 express reporting problem.

error message:

This feature "remote access to report data sources and/or the report server database" is not supported in this edition of reporting service

I got this error message when I try to connect to database hosted in another PC running SQL server 2000.

Is it true that SQlL server Express can only use Local Database Engine to host the database?



View 5 Replies View Related

Report - Tables Inside A List Side By Side

Apr 3, 2008

All,

I was trying to do something like puting two tables side-by-side inside a list, and list itself is grouped by a field.
But for some reason, two tables are not organzied pararally even there is no page break inserted.

Please help. Tks in advance.

Alex

View 1 Replies View Related

Why Would Tables Pulled In From ODBC In Access Be Different Than Tables In SQL 2005 Tables?

Jan 24, 2008

I'm new to my company, although not new to SQL 2005 and I found something interesting. I don't have an ERD yet, and so I was asking a co-worker what table some data was in, they told me a table that is NOT in SQL Server 2005's list of tables, views or synonyms.

I thought that was strange, and so I searched over and over again and still I couldn't find it. Then I did a select statement the table that Access thinks exists and SQL Server does not show and to my shock, the select statement pulled in data!

So how did this happen? How can I find the object in SSMS folder listing of tables/views or whatever and what am I overlooking?

Thanks,
Keith

View 4 Replies View Related

Reporting Services :: Add Sub-report To Main Report Using Report Builder?

Sep 9, 2015

I just created a report builder. I have a main report and i wanted to create a sub report. why i cant or i cant view the path or the folder of my  .rdl file to be use as my sub report.

View 5 Replies View Related

Modifying A Report Created In Report Builder In The Report Designer.

Jun 30, 2006

After I use the report builder to create a generic report, how do I actually get that report into the report designer so that I can modify it more effectivly?



The issue that I have now is that the file on the report server is not a .rdl file and if I simply save it as one and then bring it into VS to modify it the code file is a html structure rater than a XML file type.



Any suggestions would be appreciated. Thanks

View 3 Replies View Related

How Do I Jump To Another Report Based On A Value In My Current Report? Report Has No Parameters.

May 3, 2007

How do I jump to another report based on a value in my current report. The report that I am jumping from has no parameters, just values.

View 7 Replies View Related

Track The Changes To Normalised Tables And Update The Denormalised Tables Depending On The Changes To Normalised Tables

Dec 7, 2006

We have 20 -30 normalized tables in our dartabase . Also we have 4tables where we store the calculated data fron those normalised tables.The Reason we have these 4 denormalised tables is when we try to dothe calcultion on the fly, our site becomes very slow. So We haveprecalculated and stored it in 4 tables.The Process we use to do the precalcultion, will get do thecalculation and and store it in a temp table. It will compare the thetemp with denormalised tables and insert new rows , delte the old oneans update if any changes.This process take about 20 mins - 60mins. Ittakes long time because in this process we first do the calculationregardless of changes and then do a compare to see what are changed andremove if any rows are deleted, and insert new rowsand update thechanges.Now we like to capture the rows/columns changed in the normalisedtables and do only those chages to the denormalised table , which weare hoping will reduce the processing time by atleast 50%WE have upgraded to SQL SERVER 2005.So We like to use the newtechnology for this process.I have to design the a model to capture the changes and updated onlythose changes.I have the list of normalised tables and te columns which will affectthe end results.I thought of using Triggers or OUTPUT clause to capture the changes.Please help me with the any ideas how to design the new process

View 3 Replies View Related

Report Builder: How Can I Append Two Table Fields To Report In Report Builder

Feb 6, 2008


Hi,



When i select datasource in Report Builder, i am able to see all the available DataSources.

Eg: I have selected one datasource from the list and which has 3 tables(table1, table2, table3) associated to that datasource.



when i drag and drop table1 fields to report, i am not able to see the other 2 tables(table2 & table3)

Is there any property or relationship do i need to maintain?



Thanks,
SR.

View 5 Replies View Related

SQL 2012 :: Extract All Tables Names And Their Row Counts From Linked Server Tables

Oct 7, 2015

I am using the following select statement to get the row count from SQL linked server table.

SELECT Count(*) FROM OPENQUERY (CMSPROD, 'Select * From MHDLIB.MHSERV0P')

MHDLIB is the library name in IBM DB2 database. The above query gives me only the row count of table MHSERV0P. However, I need to get the names, rowcounts, and sizes of all tables that exist in MHDLIB librray. Is it possible at all?

View 1 Replies View Related

Solution!-Create Access/Jet DB, Tables, Delete Tables, Compact Database

Feb 5, 2007

From Newbie to Newbie,



Add reference to:

'Microsoft ActiveX Data Objects 2.8 Library

'Microsoft ADO Ext.2.8 for DDL and Security

'Microsoft Jet and Replication Objects 2.6 Library

--------------------------------------------------------

Imports System.IO

Imports System.IO.File





Code Snippet

'BACKUP DATABASE

Public Shared Sub Restart()

End Sub



'You have to have a BackUps folder included into your release!

Private Sub BackUpDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackUpDB.Click
Dim addtimestamp As String
Dim f As String
Dim z As String
Dim g As String
Dim Dialogbox1 As New Backupinfo


addtimestamp = Format(Now(), "_MMddyy_HHmm")
z = "C:Program FilesVSoftAppMissNewAppDB.mdb"
g = addtimestamp + ".mdb"


'Add timestamp and .mdb endging to NewAppDB
f = "C:Program FilesVSoftAppMissBackUpsNewAppDB" & g & ""



Try

File.Copy(z, f)

Catch ex As System.Exception

System.Windows.Forms.MessageBox.Show(ex.Message)

End Try



MsgBox("Backup completed succesfully.")
If Dialogbox1.ShowDialog = Windows.Forms.DialogResult.OK Then
End If
End Sub






Code Snippet

'RESTORE DATABASE

Private Sub RestoreDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

RestoreDB.Click
Dim Filename As String
Dim Restart1 As New RestoreRestart
Dim overwrite As Boolean
overwrite = True
Dim xi As String


With OpenFileDialog1
.Filter = "Database files (*.mdb)|*.mdb|" & "All files|*.*"
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
Filename = .FileName



'Strips restored database from the timestamp
xi = "C:Program FilesVSoftAppMissNewAppDB.mdb"
File.Copy(Filename, xi, overwrite)
End If
End With


'Notify user
MsgBox("Data restored successfully")


Restart()
If Restart1.ShowDialog = Windows.Forms.DialogResult.OK Then
Application.Restart()
End If
End Sub








Code Snippet

'CREATE NEW DATABASE

Private Sub CreateNewDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

CreateNewDB.Click
Dim L As New DatabaseEraseWarning
Dim Cat As ADOX.Catalog
Cat = New ADOX.Catalog
Dim Restart2 As New NewDBRestart
If File.Exists("C:Program FilesVSoftAppMissNewAppDB.mdb") Then
If L.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
Exit Sub
Else
File.Delete("C:Program FilesVSoftAppMissNewAppDB.mdb")
End If
End If
Cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesVSoftAppMissNewAppDB.mdb;

Jet OLEDB:Engine Type=5")

Dim Cn As ADODB.Connection
'Dim Cat As ADOX.Catalog
Dim Tablename As ADOX.Table
'Taylor these according to your need - add so many column as you need.
Dim col As ADOX.Column = New ADOX.Column
Dim col1 As ADOX.Column = New ADOX.Column
Dim col2 As ADOX.Column = New ADOX.Column
Dim col3 As ADOX.Column = New ADOX.Column
Dim col4 As ADOX.Column = New ADOX.Column
Dim col5 As ADOX.Column = New ADOX.Column
Dim col6 As ADOX.Column = New ADOX.Column
Dim col7 As ADOX.Column = New ADOX.Column
Dim col8 As ADOX.Column = New ADOX.Column

Cn = New ADODB.Connection
Cat = New ADOX.Catalog
Tablename = New ADOX.Table



'Open the connection
Cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesVSoftAppMissNewAppDB.mdb;Jet

OLEDB:Engine Type=5")


'Open the Catalog
Cat.ActiveConnection = Cn



'Create the table (you can name it anyway you want)
Tablename.Name = "Table1"


'Taylor according to your need - add so many column as you need. Watch for the DataType!
col.Name = "ID"
col.Type = ADOX.DataTypeEnum.adInteger
col1.Name = "MA"
col1.Type = ADOX.DataTypeEnum.adInteger
col1.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col2.Name = "FName"
col2.Type = ADOX.DataTypeEnum.adVarWChar
col2.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col3.Name = "LName"
col3.Type = ADOX.DataTypeEnum.adVarWChar
col3.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col4.Name = "DOB"
col4.Type = ADOX.DataTypeEnum.adDate
col4.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col5.Name = "Gender"
col5.Type = ADOX.DataTypeEnum.adVarWChar
col5.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col6.Name = "Phone1"
col6.Type = ADOX.DataTypeEnum.adVarWChar
col6.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col7.Name = "Phone2"
col7.Type = ADOX.DataTypeEnum.adVarWChar
col7.Attributes = ADOX.ColumnAttributesEnum.adColNullable
col8.Name = "Notes"
col8.Type = ADOX.DataTypeEnum.adVarWChar
col8.Attributes = ADOX.ColumnAttributesEnum.adColNullable



Tablename.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "ID")


'You have to append all your columns you have created above
Tablename.Columns.Append(col)
Tablename.Columns.Append(col1)
Tablename.Columns.Append(col2)
Tablename.Columns.Append(col3)
Tablename.Columns.Append(col4)
Tablename.Columns.Append(col5)
Tablename.Columns.Append(col6)
Tablename.Columns.Append(col7)
Tablename.Columns.Append(col8)



'Append the newly created table to the Tables Collection
Cat.Tables.Append(Tablename)



'User notification )
MsgBox("A new empty database was created successfully")


'clean up objects
Tablename = Nothing
Cat = Nothing
Cn.Close()
Cn = Nothing


'Restart application
If Restart2.ShowDialog() = Windows.Forms.DialogResult.OK Then
Application.Restart()
End If

End Sub








Code Snippet



'COMPACT DATABASE

Private Sub CompactDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

CompactDB.Click
Dim JRO As JRO.JetEngine
JRO = New JRO.JetEngine


'The first source is the original, the second is the compacted database under an other name.
JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program

FilesVSoftAppMissNewAppDB.mdb; Jet OLEDB:Engine Type=5", "Provider=Microsoft.Jet.OLEDB.4.0;

Data Source=C:Program FilesVSoftAppMissNewAppDBComp.mdb; JetOLEDB:Engine Type=5")


'Original (not compacted database is deleted)
File.Delete("C:Program FilesVSoftAppMissNewAppDB.mdb")


'Compacted database is renamed to the original databas's neme.
Rename("C:Program FilesVSoftAppMissNewAppDBComp.mdb", "C:Program FilesVSoftAppMissNewAppDB.mdb")


'User notification
MsgBox("The database was compacted successfully")

End Sub

End Class

View 1 Replies View Related

Can I Export Tables So That Existing Tables In Destination Database Will Be Modified?

Jul 20, 2005

I'm working on an ASP.Net project where I want to test code on a localmachine using a local database as a back-end, and then export it tothe production machine where it uses the hosting provider's SQL Serverdatabase on the back-end. Is there a way to export tables from oneSQL Server database to another in such a way that if a table alreadyexists in the destination database, it will be updated to reflect thechanges to the local table, without existing data in the destinationtable being lost? e.g. suppose I change some tables in my localdatabase by adding new fields. Can I "export" these changes to thedestination database so that the new fields will be added to thedestination tables (and filled in with default values), without losingdata in the destination tables?If I run the DTS Import/Export Wizard that comes with SQL Server andchoose "Copy table(s) and view(s) from the source database" and choosethe tables I want to copy, there is apparently no option *not* to copythe data, and since I don't want to copy the data, that choice doesn'twork. If instead of "Copy table(s) and view(s) from the sourcedatabase", I choose "Copy objects and data between SQL Serverdatabases", then on the following options I can uncheck the "CopyData" box to prevent data being copied. But for the "CreateDestination Objects" choices, I have to uncheck "Drop destinationobjects first" since I don't want to lose the existing data. But whenI uncheck that and try to do the copy, I get collisions between theproperties of the local table and the existing destination table,e.g.:"Table 'wbuser' already has a primary key defined on it."Is there no way to do what I want using the DTS Import/Export Wizard?Can it be done some other way?-Bennett

View 3 Replies View Related

Saving Tables That Are Generated By Queries As HTML File Or Sub-tables

Oct 17, 2006

I have a trade data tables (about 10) and I need to retrieve information based on input parameters. Each table has about 3-4 million rows.

The table has columns like Commodity, Unit, Quantity, Value, Month, Country

A typical query I use to select data is "Select top 10 commodity , sum(value), sum(quantity) , column4, column5, column6 from table where month=xx and country=xxxx"

The column4 = (column2)/(total sum of value) and column 5=(column3)/(total sum of quantity). Column6=column5/column4.

It takes about 3-4 minutes for the query to complete and its a lot of time specially since I need to pull this information from a webpage.

I wanted to know if there is an alternate way to pull the data from server ?

I mean can I write a script that creates tables for all the input combinations i.e month x country (12x228) and save them in table (subtable-table) with a naming convention so from the web I can just pull the table with input parameters mapped to name convention and not running any runtime queries on database ??

OR

Can I write a script that creates a html files for each table for all input combinations save them ?

OR

Is there exists any other solution ?

View 1 Replies View Related







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