I have an application that has already been deployed and we need to add a
new column to some of the tables in the application database. We are using
an access database. We have a solution working that basically opens a
dataset for each of the tables that needs updating, this dataset selects all
rows with the new column and the exception that arises when the column dies
not exist is caught and dealt with. It works fine with one exception and
that is that when the database has the column and a load of data in it
reading the dataset takes a long time.
'
' Iterate through the data tables
'
For Each oTableRow In oTableNames.Tables("Tables").Rows
Dim strTableName As String
strTableName = oTableRow("TableName")
oDatabase.Progress("Processing " & strTableName & " ...")
'
' Check if the tables has a "Comment" column, if not add it
'
Try
oTableRecords = oDatabase.GetDataset("SELECT Comment FROM " & strTableName,
"TableRecords")
Catch ex As Exception
'
' "Comment" not found, add it to this table
'
End try
Is there a way to check if the tables in the database have the required
column with using a select query to attempt to read those columns?
Thanks,
Sid. 2 1131
Sid,
You might try a select statement that does not return any data:
"SELECT Comment FROM " & strTableName & " Where 1 = 0"
Kerry Moorman
"Sid Price" wrote:
I have an application that has already been deployed and we need to add a
new column to some of the tables in the application database. We are using
an access database. We have a solution working that basically opens a
dataset for each of the tables that needs updating, this dataset selects all
rows with the new column and the exception that arises when the column dies
not exist is caught and dealt with. It works fine with one exception and
that is that when the database has the column and a load of data in it
reading the dataset takes a long time.
'
' Iterate through the data tables
'
For Each oTableRow In oTableNames.Tables("Tables").Rows
Dim strTableName As String
strTableName = oTableRow("TableName")
oDatabase.Progress("Processing " & strTableName & " ...")
'
' Check if the tables has a "Comment" column, if not add it
'
Try
oTableRecords = oDatabase.GetDataset("SELECT Comment FROM " & strTableName,
"TableRecords")
Catch ex As Exception
'
' "Comment" not found, add it to this table
'
End try
Is there a way to check if the tables in the database have the required
column with using a select query to attempt to read those columns?
Thanks,
Sid.
Thank you, that did indeed speed things up enormously,
Sid.
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
Sid,
You might try a select statement that does not return any data:
"SELECT Comment FROM " & strTableName & " Where 1 = 0"
Kerry Moorman
"Sid Price" wrote:
>I have an application that has already been deployed and we need to add a new column to some of the tables in the application database. We are using an access database. We have a solution working that basically opens a dataset for each of the tables that needs updating, this dataset selects all rows with the new column and the exception that arises when the column dies not exist is caught and dealt with. It works fine with one exception and that is that when the database has the column and a load of data in it reading the dataset takes a long time.
'
' Iterate through the data tables
'
For Each oTableRow In oTableNames.Tables("Tables").Rows
Dim strTableName As String
strTableName = oTableRow("TableName")
oDatabase.Progress("Processing " & strTableName & " ...")
'
' Check if the tables has a "Comment" column, if not add it
'
Try
oTableRecords = oDatabase.GetDataset("SELECT Comment FROM " & strTableName, "TableRecords")
Catch ex As Exception
'
' "Comment" not found, add it to this table
'
End try
Is there a way to check if the tables in the database have the required column with using a select query to attempt to read those columns?
Thanks, Sid. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: cwbp17 |
last post by:
Have two tables that have a FK relationship on ID column.
Have one datagrid that displays all of the columns of both tables.
What's the best approach on updating a row from the datagrid back to...
|
by: Robert Schneider |
last post by:
Hi to all,
I don't understand that: I try to delete a record via JDBC. But I always
get the error SQL7008 with the error code 3. It seems that this has
something to do with journaling, since the...
|
by: cwbp17 |
last post by:
I'm having trouble updating individual datagrid cells.
Have two tables car_master (columns include Car_ID, YEAR,VEHICLE) and
car_detail (columns include Car_ID,PRICE,MILEAGE,and BODY);both tables...
|
by: Kai Thorsrud |
last post by:
Hi,
I've only got a typical crappy Microsoft book about ADO.NET (MSPRESS
!"(¤#&/()&¤# you for mixing manual written code and suddenly adding
designtime controls and wizards for updating data)
...
|
by: Lars Netzel |
last post by:
A little background:
I use three Datagrids that are in a child parent relation.
I Use Negative Autoincrement on the the DataTables and that's workning nice.
My problem is when I Update these...
|
by: Alexey.Murin |
last post by:
The application we are developing uses MS Access 2003 database (with
help of ADO).
We have noticed that during massive records updating the size of the
mdb file increases dramatically (from 3-4 to...
|
by: Geoff |
last post by:
Hi
I'm hoping somebody can help me with the following problem that has occurred
to me.
Suppose I have two tables in an SQL Server database. Let's call these tables
A and B. Assume that A has...
|
by: bill |
last post by:
In an application I am writing the user can define a series of
steps to be followed. I save them in a sql database using the
field "order" (a smallint) as the primary key.
(there are in the range...
|
by: xMetalDetectorx |
last post by:
Hi Everyone,
I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |