|
|
How can I cancel the addnew record process when i filled some columns in the last row of the datagrid, and I change my mind and don't want to save the new row to the database? If I cancel the beforeupdate event I am still in the last row, but I want to quit from the last row and clear its columns. How can I do that?
Thanks for any advice!
|
|
|
|
|
How to get the current selected row in DataGrid without having to use DataGrid method?
Is there any way by using the DataSet method or properties?
Thank you!
Let's roll!
|
|
|
|
|
Take a look at http://www.syncfusion.com/FAQ/WinForms/default.asp#44...
Free your mind...
|
|
|
|
|
Can anybody suggest a couple good books for ADO.Net? I've found, bought and looked through several but they all tell you how to connect to a database, download the info and then Console.WriteLine() the results.
But what about real world where the data needs to be manipulated, moved, handed off, etc? Getting into the detail of evaluating data within the tables/datasets to determine what changes have been made? Taking a subset of one of the tables and creating a new table and returning only that (no, the situation does not allow the user to do their own filtering). Patience and money is starting to build constraints and unfortunately, I don't have a lot of people here to talk to for C# and .Net.
Just wondering if anybody can suggest a couple good books. I appreciate the help.
db
|
|
|
|
|
|
Microsoft Press ADO.NET core reference
nevhile.net
|
|
|
|
|
Everybody help, I have proxy server set up in LAN, how visit long-range sqlserver through ado I then -
|
|
|
|
|
Does anyone know of any third party SQL tools for .Net that aid in the development of database applications?
|
|
|
|
|
I can't remember off hand, however, I do remember seeing something on www.asp.net and also on the MSDN website under the DotNET section, not SQL.
|
|
|
|
|
In the .NET Framework there are two Base Class Libraries OLEDB and SQLCLient. Both of them can connect to a SQL server but OLEDB has togo through a COM Component which takes a performance hit. I was just wondering whether this performance hit is big enough to make me not want to use OLEDB and strictly use SQLCLient.
|
|
|
|
|
SQLClient is strictly for Microsoft's SQL Server. If your using MSSQL Server and you don't need your code to be portable(.NET isn't exactly portable yet), then I would use SQLClient.
|
|
|
|
|
Yes I know that but does OLEDB and SQLClient have a major performance difference?
TIA
|
|
|
|
|
|
|
Can CDAORecordset (in VC6 or VC7) deal with Access 2000 or 2002 ?
or.. is this just an MDAC issue?
(DB newbie)
-c
ImgSource | CheeseWeasle
|
|
|
|
|
Sadly, not an MDAC only issue. The problem is that the MFC DAO support is hardcoded to load particular versions of DAO, and won't "automatically" use the latest version. There's an MSKB article on it (Q236991), which explains how to resolve it for apps that dynamically link to MFC, and a brief explanation of what to change for apps that static-link. (They advocate a full build of MFC, but I'm sure I've seen another workaround as well).
Steve S
|
|
|
|
|
Hello there i have a project which i want to run on windows o.s.
Now the only problem i am facing is that when i use the same
#import "G:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" rename("EOF", "ADOEOF")
using namespace ADODB;
i get an error and also i did a search on msado15.dll in windows 95 it was not there.
my connection string is like this.
TCHAR pAppPath[_MAX_PATH];
GetModuleFileName(NULL,pAppPath,_MAX_PATH);
// Trucating and attaching the mdb file path
CString csAppPath(pAppPath);
csAppPath = csAppPath.Left(csAppPath.ReverseFind( '\' ));
csAppPath+="\\BackUp.mdb";
// Adding other information to the mdb file
CString csConStr = "Driver={Microsoft Access Driver (*.mdb)};";
csConStr += "Dbq=";
csConStr += csAppPath;
csConStr+= ";Uid=;Pwd=;";
I could use jet ole db provider but the problem is the no driver or provider is present in windows 95 and 97.
After search on internet i found a solution about installing mdac and dcom95 and then running the thing and it worked but the redistribuatable was like 8 and 1.3 MBs which i don't want
somebody also told me to package my mdb with project and use jet engine i haven't looke at the redistributable for jet but it may be some MB'S.
The problem is there redistributables are heavy.
What i need is a simpler and smaller solution.
to using ado with msacces on windows95.
My second question is can we include just msado15.dll
without whole of the path coz system directory could be on any partition volume.
I need urget help regarding these two matters and i would be more than greatful for a viable solution
|
|
|
|
|
You could use DAO, rather than ADO, as it's lighter weight, but then you'll probably have to rewrite chunks of your code.
Your second question is easier. Using Tools/Options/Directories add the actual path of MSADO15.DLL into the INCLUDE section and use
#import <msado15.dll> rename("EOF","ADOEOF")
You need the path at compile time, not runtime, which does require that the components be installed, so you have no option to to install MDAC.
Steve S
|
|
|
|
|
Ok Using Tools/Options/Directories i added the directory path.
After that i did this
#import <msado15.dll> rename("EOF", "ADOEOF")
using namespace ADODB;
It works and doesn't give any error message now i would like to know one thing now if i take it to some pc where there is no msado15.dll would it work.
and also if its on a different path then the path i gave in the directory settings would it do.
And would there be no version conflict with already installed msado15.dll.
So there are three question which actually arose in my mind.
And i would also like to make clear what does these settings do, compile time settings do they bring in the msado15.dll into my project or what.
|
|
|
|
|
Ok Using Tools/Options/Directories i added the directory path.
After that i did this
#import <msado15.dll> rename("EOF", "ADOEOF")
using namespace ADODB;
It works and doesn't give any error message now i would like to know one thing now if i take it to some pc where there is no msado15.dll would it work.
and also if its on a different path then the path i gave in the directory settings would it do.
And would there be no version conflict with already installed msado15.dll.
So there are three question which actually arose in my mind.
And i would also like to make clear what does these settings do, compile time settings do they bring in the msado15.dll into my project or what.
I think i am getting somewhere with the help you provided. Thank you very much Steve.
|
|
|
|
|
1. If there's no MSADO15.DLL, it won't work; this is why MDAC 2.x needs to be installed.
2. If it's on a different path, it would work (since at runtime you're using the registry entries to locate stuff -- part of COM)
3. You won't ship MSADO15.DLL with your app.
What #import does is examine the type library of the specified file (in this case MSADO15.DLL) and it then generates .TLH and possibly .TLI files. These are compiler-generated, usually once in a project, and automatically pulled in when the source module (CPP or H file) is used by the compiler. These define the appropriate interface wrappers with methods etc, and normally include definitions for things like smart pointers using the CComPtr template.
It definitely does NOT pull in any DLLs into your app. The stuff it produces means that it's easier to work with COM objects in C++, almost as easy as with VB.
Hope this helps.
Steve S
|
|
|
|
|
I am going to be using msado15.dll is there any way i don't give the absolute path like given below.
#import "G:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" rename("EOF", "ADOEOF")
using namespace ADODB;
and just use
#import <msado15.dll>
or use #include "msado15.tlh"
or tlb any thing but without whole path.
And one main thing i would be using my project in any windows.
The whole of the path should not be given coz system directory could be on any partition volume.
c:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" rename("EOF", "ADOEOF")
using namespace ADODB;
I am going to include msado15 setting in stdafx.h.
Thanx in advance.
|
|
|
|
|
Hi
I have a windows form with textboxex liked to a dataset, using databindings, i din´t want that the user autoedit records, for another words i don´t want that the user write in a textbox directly without click in a button for "EditMode".
I tried the readonly and the enabled controls properties, but both change the control color and i don´t want that.
Someone have the same problem?
PB
|
|
|
|
|
the following is the ocde to accessa ms database using ADO..
the code connects it to the databse..but
how to display the output..
kindly help me in this regard..
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include "STDAFX.H"
//#include "AFX.H"
#import "c:\program files\common files\system\ado\msado15.dll" rename("EOF", "EOFile")
struct StartOLEProcess
{
StartOLEProcess()
{
::CoInitialize(NULL);
}
~StartOLEProcess()
{
::CoUninitialize();
}
} _start_StartOLEProcess;
void main(void)
{
ADODB::_ConnectionPtr m_pConnection = NULL;
ADODB::_RecordsetPtr pRecordset = NULL;
//ADODB::FieldPtr pAuthor;
//_variant_t vAuthor;
//char sAuthor[40];
//HRESULT hr = S_OK;
VARIANT *vRecordsAffected = NULL;
char ConStr[500];
//VARIANT *vRecordsAffected = NULL;
//int ctr;
/*
printf("\nEnter Database Path and File name: ");
fgets(File, 250, stdin);
for (ctr = 0; (unsigned int)ctr < strlen(File); ctr++)
{
if (File[ctr] == '\n')
{
File[ctr] = '\0';
break;
}
}
ConStr[0] = '\0';
strcat(ConStr, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=");
strcat(ConStr, File);
hr = con.CreateInstance(__uuidof(ADODB::Connection));
printf("\nCreateInstance result= %d uuidof= %d\n", hr, __uuidof(ADODB::Connection));
printf("\nConnection object created.");
con->Open(ConStr, "", "", 0);
// Create a Connection object and open it with mcb.krz, an access database
_ConnectionPtr m_pConnection; */
BOOL m_bIsConnectionOpen;
// Create an instance of _Connection
HRESULT hr ;
hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection));
cout << "Connection object created." ;
if (SUCCEEDED(hr))
{
//Open a connection where database is access database : "d:\mcb.krz"
//
/*
hr = m_pConnection->Open( _bstr_t(L"Provider=Microsoft.Jet.OLEDB.3.51);
Data Source= "c:\\emailparsing\\email_details.mdb;"), _bstr_t(L""), _bstr_t(L""),adModeUnknown);*/
ConStr[0] = '\0';
strcat(ConStr, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=");
strcat(ConStr, "c:\\emailparsing\\email_details.mdb" );
m_pConnection->Open(ConStr, "", "", 0);
//If database opened successfully then set IsConnectionOpen to TRUE
if (SUCCEEDED(hr))
{
m_bIsConnectionOpen = TRUE;
}
}
//_RecordsetPtr pRecordset;
// Here I take data from a table called KRUSE1 which has two fields a0, and a1 of TEXT type
_bstr_t bstrQuery("SELECT * FROM Emaildetails");
_variant_t vRecsAffected(0L);
try
{
ConStr[0] = '\0';
strcat(ConStr, "SELECT * FROM ");
strcat(ConStr,"Emaildetails");
pRecordset = m_pConnection->Execute(ConStr, vRecordsAffected, 1);
//pRecordset = m_pConnection->Execute(bstrQuery, &vRecsAffected,adOptionUnspecified);
if (!pRecordset->GetEOFile())
{
cout <<"maari" ;
int i = 0;
_variant_t vFirstName;
_variant_t vLastName;
while (!pRecordset->GetEOFile())
{
vFirstName = pRecordset->GetCollect(L"email_address") ;
cout << "success" << endl;
vLastName = pRecordset->GetCollect(L"type") ;
// now you got vFirstName and vLastName values and do whatever u want.
i++;
pRecordset->MoveNext();
}
}
pRecordset->Close();
}
catch(...)
{
}
}
the connection is been made..and i think this program is able to access the mdb file also..but how to display the data ..
what is the variable to be used to get the data and display it in the output exe file??
ranjani
|
|
|
|