|
I am trying to access the Connection String in a Linked MS Access table.
This is easy inside of Access - but I can not seem to do it through ADO.NET.
I have been able to get as far as using ADOX and listing out the Tabledef properties,
The connection string is property index 5 - but I can not write anything back.
I need to be able to change this setting.
Help - anybody - Been wracking my brain on this one - so close - but I haven't found
any articles on this.
Kurt
|
|
|
|
|
Has anyone else experienced problems with Access accessed through ODBC?
I'm using JDBC and the JDBC-ODBC bridge from Sun. The process is this:
1. A row, let's call it <code>R</code>, is updated using SQL an not the updateXXX API.
2. <code>R</code> is fetched into a resultset and a <code>long</code> value, L, is retrieved.
3. <code>L</code> is incremented and <code>R</code> gets updated, again using simple SQL.
The problem is in step 3. The executeUpdate() reports that 1 row is updated, and if I had executed the SQL in Access directly that would have been the case.
But the row is actually not updated at all, the Statement object is set to AutoCommit and everythings seems fine, so this is really the most horrible of all errors: One that just silently let's the user, and the developer, think that all is OK while the data just gets corrupted.
One solution could be to use MSDE instead, but I'm sure that a lot of users would want to use Access.
I really would like to know if this is an ODBC problem or an error in the JDBC-ODBC bridge.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
hello ,everyone!
I bind datatable to datagrid,and edit datarow value from the datagrid.
the value modified in datagrid and changed in datatable via debugging code.
My question is why the datarow's rowstate property value can't be changed to
modified automatically by this mothed ,however if i changed the datarow value from datatable directly ,it did? so that i can't update database
who can help me ? thinks
lu6
|
|
|
|
|
Hi, I got the following question.
I got 2 tables in Lets say A and B
Structures of the tables are:
"A" table "B" Table
OldName Number New_name Number Value Time
Time field in "B" table in following format "YYYY-MM-DD HH24:MI:SS"
So knowing the alias I can easily create a query:
select A.New_Name,A.Old_Name,B.Value,B.Time from A,B where A.Number = B.Number AND B.Time BETWEEN '2003-12-01' AND '2004-01-30' AND (A.New_Name like '%mw%' OR A.New_Name like '%mv%');
Everything worked so far. But, cause Value probe in "B" table happening every 3 minutes, and Name entries are about 10000 in the table,identified by '%mv" and '%mw', I simply cannot get some much data (imaging 60 days * 60min/3min * 24 * 10000 and you will get the magic number of rows. Tried to run it throught Database client or Vbscript ADO connections it is taking about 4 hours to complete. Cause I'm having 20 tables like that on 20 independent servers it is simply unacceptable for a time frame. So, we dicided instead of each minute to get an average for an each hour. I cannot get an average throught Vbscript (programmatically), cause it will not improve the database dump performance, I've to do it throught SQL. And here is the problem, I'm very familiar with MySQL logic and syntaksis, but this is my first time I'm querying Microsoft SQL server. Tried to construct the query - didn't work.
So result of my query should look like that
Time Name Value
01-30-04 00:00 abbmw 10
01-30-04 01:00 bbccmv 20
01-30-04 02:00 cccmvar 30
and so on.
Can somebody help me with this ?
Thank you very much.
Sincerely
vladfrenkel
|
|
|
|
|
I'm not sure whether this may help, but it doesn't hurt to try:
1. Index your tables, especially A.Number, B.Number, B.Time. I don't think indexing A.New_Name will help if you're using wildcard. Indexing your tables will help the performance when you're doing a search.
2. Do not write your SQL statements in the VBScript. Write them as Views (queries) in the SQL Database.
Views are precompiled (correct me if I'm wrong) and runs faster than a statement passed through VBScript.
You can then call the views from your VBScript (e.g. 'SELECT * FROM qryAB').
3. I'm guessing the reason the query is taking too long is the wildcard used. You may want to create a query just to join tables A and B (SELECT A.New_Name, A.Old_Name, B.Value, B.Time FROM A INNER JOIN B ON A.Number = B.Number WHERE B.Time BETWEEN '2003-12-01' AND '2004-01-30'). If this query doesn't take a long time then the wildcard is the cause.
After that, you can split the next View into two to get the final result, i.e.
"SELECT * FROM firstQuery WHERE New_Name LIKE '%mw%'"
"SELECT * FROM secondQuery WHERE New_Name LIKE '%mw'"
If you need the results as one then you don't need to split the Views. But if you're fine with it, there are ways to split the query so you can work on smaller portions of the data.
I hope it helps .
|
|
|
|
|
I am trying to read an XML document into a .NET DataSet object. I used the XSD.EXE utility to generate a schema file for this XML document. This schema has re-ocurring elements that I would like to load as records into my DataSet. However, I only want to load certain child elements as fields into the DataSet record.
Is there a way I can modify this schema file such that I can use the DataSet.ReadXml method to parse this XML file and create the proper table rows??
Thanks
|
|
|
|
|
I don't know if this is good way or not, DataSet.ReadXML() accept stream of XML or XML Text, with XML classes such as XMLReader or XPath classes for XML first load your proper nodes into XMLReader or String and then pass this parameter into DataSet.ReadXML() .
Mazy
No sig. available now.
|
|
|
|
|
Hi Gang,
Here's what I've got,
I've got information stored in one table/database that I'd like to move to another table/database.
Sounds pretty simple doesn't it?
Well, here's where the pickle comes into play.
The tables could potentially be dynamic. So I can't used a predefined DataSet to do the moves, so I have to recreate the datasets each time. That part isn't even necessarily the problem.
The problem I'm running into is:
What happens when my tables have memo fields in them?
Some of our tables have Ole embedded (Not my choice, but I have to live with it) in them that also need to be mapped.
I'm trying to do this all with ado.net using C#.
If I can't I'll probably just end up writing it in VB6. I know we can do it in there, we have. But then again, that's using DAO, not ADO.Net.
Anybody have any suggestions?
Thanks,
Nick
Env: Studio 2003, MS:Access 2000 Databases, WinXP Pro+Patched
This are my own opinions. You know the rest.....
|
|
|
|
|
Hi, I´m using the CDao classes from the MFC to manipulate and store data in an Access 97 db, using the Jet 3.5. engine. I was wondering if there are any good books that someone could suggest for reading. Any thing I´ve found sofar is all to to with VB. Even the various help files use VB examples. (I´m using Dev Studio 97 VC++ 5.0).
Normal opererations like deleteing,adding,modifying,
querydef´s and the like is quite simple, but creating relationshiups between tables is quite annoying, and the msdn does not help that much.
Thanks in advance
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Phil
Most of the samples you'll find will be VB. Many of the Office related technologies are promoted (at least, their automation models are!) through use of VB, VBA or VBS. In the case of JET this isn't exactly a surprise, given the use of VB as the scripting language.
However, I assume you've already got the DAO SDK (I believe it's on the VC++ CD). You could try getting hold of the JET Programmers Guide, which is (or was) an MS Press book.
Another thing to do is get hold of the VB->VC++ automation conversion tool that was on the MSDN site some time ago. It doesn't do 100% conversion of course, but usually enough to get you started on the right road.
Steve S
|
|
|
|
|
Thanks Steve, I had almost given up getting a reply
I´ll look into what you have suggested, and thanks once again for your time.
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Hi Steve, me again....
I´ve managed to find the book you mentioned, I´ll have to see if I can order it.
As for the automation conversion tool you mentioned, I have not been able to find it, do you still have a link to it?
Thanks in advance
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Hi,
Is there any article available here which gives me an idea of connecting a c++ application to the database. I want to write a console database application. I don't want to use the MFC classes.
Kindly help.
regards,
vini
|
|
|
|
|
Then you can use ODBC directly. Or, better yet, get or write your own wrapper classes around ODBC.
I have used my own set of ODBC wrapper classes since ODBC came out. Never have to think about it again...
onwards and upwards...
|
|
|
|
|
i insert one calculate datacolumn into datatable,and set the column expression, and set databinding to datagrid . when i set related column value form datagrid and update database via adosqladapter, it prompt me that i can't modify the calculate datacolumn' readonly value to be false ,however ,i never changed the column' readonly property value .why? who can help me ?
|
|
|
|
|
I had problems as well updating a join table dataset. What I did is simple check the .HasChanges (I think) property and update each table individually in a transaction.
try
'Begin a transaction
'......
If ds.Table(0).HasChanges then
'Update table(0)
end if
if ds.Table(1).HasChanges then
'Update table(0)
end if
'commit the transaction
'.....
catch ex
'Rollback the transaction
'.....
finally
'set any variable to nothing
'.....
end try
Hope this is helpful.
Michael
|
|
|
|
|
halo...everyone.l use the ado connect to the database to find out some records.And just first record display on the page but the results show in the database are over 20. and when l wrote out the record count, the answer is -1.please help me
The codes as below:
Dim objConn,objRs,strSQL
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=myName;Driver={Microsoft Paradox Driver (*.db)}"
Set objRs = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * from (mytable) WHERE condition='" & Request.Cookies("UserID") & "'"
objRs.Open strSQL,objConn,adOpenKeySet,adLockOptimistic,adCmdText
if not objRs.EOF then
Do until objRs.EOF
Response.write.......
objRs.MoveNext
Loop
end if
Thank you at advanced!
|
|
|
|
|
How can i use List Control with ADO?
Please teach me...
|
|
|
|
|
I have a table in an access database. This table has an ID field that is set to be Autonumber and it is the tables primary key.
When I insert new data I would like to know what number the new row got. Is there a nice clean simple way to do this without having to search that table for the data just entered?
|
|
|
|
|
Yes.
SELECT @@IDENTITY
Free your mind...
|
|
|
|
|
Just how do you use it? Is that the complete SQL command I need or do I need to place it in some larger SQL command or something?
|
|
|
|
|
Immediately after you insert statement call the Select @@Identity or preferably Select @ID = @@Identity where @ID is an output parameter.
create proc xyz
( @Name varchar(50),
@ID int output
)
AS
Insert into ....
....
Select @ID = @@Identity
GO
Michael
|
|
|
|
|
Can't do that on Access...
Free your mind...
|
|
|
|
|
C#
OleDbCommand vcommand = new OleDbCommand();
vcommand.CommandText = "SELECT @@IDENTITY";
vcommand.Connection = urOleDbConnection;
int vvalue = (int)vcommand.ExecuteScalar();
VB.NET
Dim vCommand as new OleDbCommand()
vcommand.CommandText = "SELECT @@IDENTITY";
vCommand.Connection = urOleDbConnection
Dim vInt as Integer = CType(vCommand.ExecuteScalar(),Integer)
Free your mind...
|
|
|
|
|
Now I got it working.
Thanks all!
|
|
|
|