|
tnolley wrote:
the DB resides on a remote machine
I'm assuming you are using MS Access, and that this is an ASP App, And that your are running Peer Web Services on your Win98 W/S.
You can share out the folder that the DB resides in:
\\servername\sharename\accessdb.mdb
You can then build your connection string by the following:
<code>Dim ConnectionToDb
Dim rsToDB
Set ConnectionToDb = Server.CreateObject("ADODB.Connection")
Set rsToDb = Server.CreateObject("ADODB.Recordset")
ConnectionToDb.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=\\servername\sharename\accessdb.mdb;" &_
"Persist Security Info=False"
rsToDB.Open "TableName", ConnectionToDb, adOpenForwardOnly, adCmdTable
While Not rsToDb.EOF
Response.Write rsToTb("FieldName")
rsToDb.MoveNext
Wend
rsToDb.Close
ConnectionToDb.Close
Set rsToDb = Nothing
Set ConnectionToDb = Nothing
Tony
|
|
|
|
|
2TallTony wrote:
I'm assuming you are using MS Access, and that this is an ASP App, And that your are running Peer Web Services on your Win98 W/S.
You can share out the folder that the DB resides in:
\\servername\sharename\accessdb.mdb
You can then build your connection string by the following:
Thanks TT. I should have been more specific. I am writing the app in Visual C++ 6.0.
My Windows98 machine is not running any web server or peer-peer networking. The app will be distributed to a wide base of clients running on a minimum of Win95 with dial-up networking.
The database on the webserver is already mapped with a DSN (it is an Access97 DB).
I just need to know how to connect to that remote DSN in VIsual C++ 6.0. I have no experience in using ActiveX components - I tried, but unlike in VB, when you use an Add-in control in VIsual C++ you have to jump through all sorts of hoops to get it to work. I am so frustrated that I am close to rewriting the entire app in VB just to use the @$#(&*#$@!*@#$ remote data connection control.
I think it will be easier to get advice on how to use a remote DB connection from within VC++ but this is now the part of the code that is causing the entrie project to just sit there and gather dust.
Any help would be greatly appreciated!
I'm going to live forever or die trying!
|
|
|
|
|
TN,
Before you re-write your application,
Try posting a message within the VC++ forum, there are many experts at coding the VC++ language that visit this site.
Sorry couldn't help.
Tony
|
|
|
|
|
2TallTony wrote:
Try posting a message within the VC++ forum, there are many experts at coding the VC++ language that visit this site.
I originally posted this thread there.
I found a workaround though - I just ported my DB from Access to MySQL and the ODBC driver for MySQL allows you to specify a servername or IP address - voila!!!!!!!
I'm going to live forever or die trying!
|
|
|
|
|
It depends very much on how your app's written.
If it's an MFC app, look at the CDatabase and CRecordset classes (connecting using ODBC), or CDaoDatabase and CDaoRecordset if you want to use Data Access Objects. For a new app I'd avoid DAO - I don't think MS intends to port Jet to 64-bit processors, and DAO only works with Jet anyway.
If the application is written with raw Win32 API calls, look up the ODBC functions directly - see SQLConnect and its kin.
I'd avoid ADO from C++. It's designed as a nice wrapper around OLE DB for languages that can't cope with multiple interfaces, especially scripting languages. From C++ it's a royal pain of constantly wrapping parameters in VARIANT s and strings in BSTR s.
If you want to tackle it, you can use OLE DB directly. If you're happy with C++ templates, you can use the OLE DB Templates. If you intend to do this, I suggest OLE DB Consumer Templates: A Programmer's Guide[^]. There are wizards for it too - go to Insert > New ATL Object, then select the Data Access category and the Consumer object.
I have tried this out once, but my boss preferred doing it 'a way that everyone can understand', with the odd result that a data import application - which looks for new files to import, then imports them - is written in VB6.
--
Mike Dimmick
|
|
|
|
|
Thanks for the reply!
It turns out that I was trying to connect to a remote Access DB and the supplied ODBC driver for MS-Access does not let you specify an IP address - you must pick a local MDB file to map the DSN.
So, I just converted the DB to MySQL and the ODBC driver for that allows you to specify an IP address for the remote datasource.
Problem solved!
I'm going to live forever or die trying!
|
|
|
|
|
When I add a DataGrid to a form and associate it to the datasource, all the columns are retrieved from the table.
This is fine, but I want to rename those columns. How to do that?
Ex: Columns in table are:
PurchaseDate, MeterReading,....
I want to display the columns in the DataGrid as Purchase Date, Current Meter Reading ...
"...if you don't want to hear things that piss you off don't piss off other people. SIMPLE." - Steven Hicks This signature was created by "Code Project Quoter".
|
|
|
|
|
|
Sorry I forgot to mention, the DataGrid was in Windows Forms, not WebUI.
Mark Nischalke wrote:
Turn off the autogenerate columns and add the columns
The AutoGenerateColumns property is only for WebControls.
This is my first take at ADO.NET
"If a jug falls upon a stone, woe to the jug. If a stone falls upon a jug, woe to the jug. Always woe to the jug"." - KaЯl This signature was created by "Code Project Quoter".
|
|
|
|
|
I am trying to pass an array to an oracle procedure using the OracleClient for .NET. I can't find away to do this/ I have trawled the net and have found a few people trying to do the same thing but no solution. The only solution given was to pass the array as a delimited string, but this is no good for my purposes as the array could get quite large.
Thanks in advance for any suggestions
Ian
|
|
|
|
|
I am having trouble installing MSDE. I am attempting to launch the installation via another setup program I am writing. This setup will install a lot of prerequisites that another app needs, one of them being MSDE.
The problem is that when I launch the MSDE installation all goes well until a little over half way through, when it just hangs. Nothing happens, ever. I can do this repeatably. I can call the setup.exe from C#, MC++ using .NET and using Win32, and also straight Win32. All cause the installation to hang.
It seems to have to do with waiting for the process to finish, because if I don't use Process.WaitForExit or WaitForSingleObject the installation will continue and finish even if launched from my app. But calling these functions causes a hang.
Here is another post about Delphi: link[^]
Here is a Win32 DLL function that I wrote (took from the above post, he said it worked for him) that causes the problem.
<code>#define APPLICATION NULL
#define COMMANDLINE _T("MSDE\\Setup.exe sapwd=testpassword")
#define CURRENTDIR NULL
extern "C" __declspec(dllexport) int NativeLaunchMSDEInstaller()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwExitCode;
BOOL br;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
br = CreateProcess(APPLICATION, COMMANDLINE, NULL, NULL,
FALSE, 0, NULL, CURRENTDIR, &si, &pi);
if (br)
{
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &dwExitCode);
CloseHandle(pi.hProcess);
}
else
{
return GetLastError();
}
return 0;
}</code>
Thanks for any help (or atleast a verification that this is a problem),
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
hello,
here is a problem i am facing.
i have a from DATE column in my table and i have a to DATE column.
i have values in from DATE column, but nothing in to DATE column.
now i want to put the values in such a into to DATE column that second value i.e value in second cell is assigned to first cell in to DATE columns and then 3rd to second of to DATE column and so on.
and at the final cell the current date.
I am using sql server2000
i can show it like this.
from to
2003-07-08 17:01:00.000 2003-08-08 17:01:00.000
2003-08-08 17:01:00.000 2003-09-08 17:01:00.000
2003-09-08 17:01:00.000 2003-10-08 17:01:00.000
2003-10-08 17:01:00.000 current date i.e. todays
Asim
|
|
|
|
|
Hello,
We're upgrading our application to use SQL Server, having used Access for some time and I need some insight, as I may have to redesign the tables.
The application is a web based front-end for our data. In the Access version, we have a completely separate database for each Client/Project who logs on, each database had the same structure. It is easier to deal with things when they had this both physical and logical division.
There is some data duplicated between the databases, and this must be manually copied, usaully when the database is first created.
Is SQLServer designed to allow multiple databases to exist independently, but still allow some common data to be shared, and also allow Stored Procedures to be shared among the different but same structured databases.
Perhaps we should go the way of combining everything into one database however I would really prefer to store them independently. I understand that Oracle may have something like this in the way of folders.
I'd appreciate any words of wisdom.
Thanks,
John
|
|
|
|
|
I would advice keeping all the data in the same database as that makes maaging the databases like backup etc. easy. Else if you want to stick to the multiple database option, you can definately store the common data in a common database and then acess the tables using notation [Common DB Name].[Table Owner].[Table Name]. As far as stored procedures are concerned, I would recommend keeping copy of same in all databases as using three part concvention as mentioned above will make the stored procedures creepy and bad performing.
Gaurav
|
|
|
|
|
Does anyone have, or know where I might be able to download a version of an MDI application that binds with Access97?
If you do, I would be indebted to your sense of helping another member of your kind, since AppWizard will NOT create ANY application using Access2K, and I don't have Access97 (which was the last version of Access that AppWizard supported for such kind of things).
Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
Only the data that is queried in the query is sent to the client and not the entire database. So you need not worry about this.
Gaurav
|
|
|
|
|
When you submit a query to the engine, the engine processes the query and checks which are the tables / records that need to be read.
Gaurav
|
|
|
|
|
hi all,
I am VC++ Programmar. We are facing Problem of Storing Images into oracle as Blob data type.Did VC++.Net oR ADO.net Helps to Store Images in Oracle Database as
Blob Datatype.
I need Help
NB:Very Urgent
Thanks In Advance
|
|
|
|
|
|
hi Mark,
Thanks For Replying.
Really I check That Article.It is Storing Images in C Sharp
I want To Store Images in Oracle Database Using VC++.Net
I am VC++ Progrmmar. I am Unable To Store The Images IN Oracle Database Using VC++ 5.0 So I need To Know and Conform
From any Dot.Net Programmars That Through VC++.Net Or VB.Net
WE can Store Images.Then I Can Recommend Company To Buy VC++.Net Or Related.
|
|
|
|
|
Just because it was written in C# doesn't change the underlying techniques.
Create a file stream, read the the image bytes into the steam, assign stream to store procedure variable, execute the procedure.
|
|
|
|
|
I need to Export Fields in a table into another Database Table on a Remote machine, at the moment I Export the records one by one and delete the records as I go along. This is very slow over a 28k connection that I need to use.(3 records per second or so, I am dealing with 1000s of records)
I would love to take all the records at once, dump the on the remote machine and then delete the lot!
I can make use of a Dataset to get all the records but how do I specify what and how to export this to another connection???
Leon v Wyk
|
|
|
|
|
Option 1: write a program to do it.
Option 2-n: depends upon the database platform you are using. For example, SQL Server has very powerful data transfer mechanisms built in, such as DTS and RPC which can run on a scheduled basis.
onwards and upwards...
|
|
|
|
|
These are the steps in script that u'll be needing-
- BCP out the data into a text file.
- FTP the file to the remote location.
- Insert the file in remote database using remote stored procedure.
- Delete the records from source database.
Hope this helps.
Gaurav
|
|
|
|
|
This is a fairly old thread, but I just stumbled across it looking for an answer to a distributed transaction question I have.
Anyway, does your export procedure need to be transactional? i.e. Do you want to ONLY delete the source records once they are in the remote system? And do you want the destination records to ONLY be valid once they are deleted from the source?
I have architected many systems like this where the data needs to be in one place OR the the other but not both, and not get lost, like in this example.
while (there are more records to export)
{
begin transaction;
try
{
export record to remote system;
delete record from local system;
commit;
}
catch ()
{
rollback;
}
}
These systems are hard to accomplish, sometimes you are better off assuming that the 2 systems are only going to communicate asychronously and then revisit the problem you are trying to solve.
If that doesn't help you one iota I won't be too suprised.
JBoy
|
|
|
|