|
no need for dsn here
specify the path of the database where you are going to install the program
and it will work fine , may be you can specify the path where your exe file is there
|
|
|
|
|
As I told you yesterday you have to look this article[^]
There you'd fine that you can connect to the DB without using a DSN name:
<br />
strConnection = _T("Driver={Microsoft Access Driver (*.mdb)};"<br />
"Dbq=c:\\DatabasePath\\dbaccess.mdb;Uid=; Pwd=;");<br />
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
-- modified at 2:28 Tuesday 6th September, 2005
|
|
|
|
|
Duplicating/Triplicating your thread won't solve it ...
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
See this link about DSN-less connections. Google for others.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
In my application .,
I am hard coded i.e., I created DSN,Database name and Table name as 'MyDSNName','MyDBName' and 'MyTable' respectively.
If I build a SetUp file for this appli., This application works only in my System .But it is not worked in other system.
So I want Flexible code ,which generates the default Databse and Table to the end user.,
(Then It will works in all Machines)
I hardcoded the code like this.,
--------------------->
CString sql,sDate;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "c:\\mydabase.mdb";
CDatabase db;
sDsn.Format("ODBC;DRIVER={%s};DSN='MyDsnName';DBQ=%s",sDriver,sFile);
db.Open(NULL,false,false,sDsn);
CRecordset recset( &db);
Praveen Chowdam Kumar
|
|
|
|
|
|
#include < iostream.h >
#include < string.h >
class string
{
char *p;
int len;
public:
string(){ len =0; p=0; }
string(const char*s)
{
len = strlen(s);
p = new char[len+1];
strcpy(p,s);
}
string(const string &s)
{
len = s.len ;
p = new char[len+1];
strcpy(p,s.p);
}
~string() { delete p; }
friend string operator+(const string &s,const string &t);
friend void show(const string s);
};
string operator+(const string &s,const string &t)
{
string temp;
temp.len =s.len +t.len ;
temp.p = new char[temp.len +1];
strcpy(temp.p ,s.p);
strcat(temp.p ,t.p);
return temp;
}
void show(const string s)
{ cout << s.p; }
// if i wrote code like this. working fine.
int main()
{
string s1 = "new", s2 = "new1", s3 = "new2";
string t1(s1),t2(s2),t3(s1+s3);
cout<<"\n t1 = ";
show(t1);
cout<<"\n t2 = ";
show(t2);
cout<<"\n";
cout<<"\n t3 = ";
show(t3);
cout<<"\n \n= ";
return 0;
}
// if i wrote code like this. Not working.
// Getting Runtime error.
int main()
{
string s1 = "new", s2 = "new1", s3 = "new2";
string t1,t2,t3;
t1=s1;
t2=s2;
t3=s1+s3;
cout<<"\n t1 = ";
show(t1);
cout<<"\n t2 = ";
show(t2);
cout<<"\n";
cout<<"\n t3 = ";
show(t3);
cout<<"\n \n= ";
return 0;
}
Nice talking to you.
|
|
|
|
|
define one assignment operator, will be similar to copy constructor. it get called at line t3=s1+s3
|
|
|
|
|
You haven't overloaded the = operator, needed for the second version. This is a simple implementation:
string operator=(const string &s)<br />
{<br />
delete p;<br />
p = new char[strlen(s.p) + 1];<br />
strcpy(p, s.p);<br />
return *this;<br />
}
I also recommend to rename your class to myString or something like that.
|
|
|
|
|
Thanks for both of you for replying.
Nice talking to you.
-- modified at 3:05 Tuesday 6th September, 2005
|
|
|
|
|
prefer string& operator=(const string& s) as operator = to allow the user to cascading the calls...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have problem opening the class wizard, as it will show an error message. After clicking ok, i wont be able to add function, variable etc. from the class wizard.
error msg:
Parsing error: Expected "="
Input Line: "if (m_hCloas == INVALID HANDLE VALUE)"
Anyone knows what has gone wrong?
|
|
|
|
|
I think you have deleted the script generated by the application wizard(Basically a C++ comment lines(Statrs with /// which is used by the App wizard).
Try to look at the similar code in other files or create a temporary project and copy those scripts.. I have to be carefull while doing this.. I don't think there any other options...
Wish you better luck
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
I think the code line would be:
if (m_hCloas == INVALID_HANDLE_VALUE)
|
|
|
|
|
thanks, i found out the problem, it lies inside the constructor. the problem is solved after i removed the 'if section' code.
does it mean i cant have an if statement inside constructor???
CTAMADlg::CTAMADlg(CWnd* pParent /*=NULL*/)
: CDialog(CTAMADlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTAMADlg)
m_hDevice = INVALID_HANDLE_VALUE;
m_hClose = INVALID_HANDLE_VALUE;
m_hClose = CreateEvent (NULL, TRUE, FALSE, NULL);
if ( m_hClose == INVALID_HANDLE_VALUE )
{
MessageBox("Thread event error!","Error",MB_OK);
}
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
|
|
|
|
|
Hi,
I am looking for the solution/guide line to convert text data into the following file format,
1.PDF
2.HTML
3.GIF
4.JPEG
5.3gp
6.DOC
7.RTF
one important point here is that all these conversion needs to be following UNICODE. There are different library available for each of the format but they are either very complex or does not support UNICODE.
does any one has simple solution for this?
Thanks.
|
|
|
|
|
struct stTst
{
stTst(){p=NULL;}
~stTst(){
if (p!=NULL) {
delete p;
}
}
int i;
int j;
char c;
int *p;
};
void CTestdeleteDlg::OnButton1()
{
int k=123;
stTst *p=new stTst[10];
p->p=&k;
delete[] p;
}
-- modified at 1:01 Tuesday 6th September, 2005
|
|
|
|
|
followait wrote:
stTst *p=new stTst[10];
Here, you are creating 10 objects of the class.
If you need only one object, then:
stTst* p = new stTst;
...
delete p;
If you really need 10 objects, then you need to access them through a subscript, like:
stTst* p = new stTst[10];
p[0]->p = &k; //etc
p[1]->p = &k2;
...
To delete all the objects:
delete[] p;
this is this.
|
|
|
|
|
It's my careless, it should be delete[] p, but still have a error.
|
|
|
|
|
You are allocating k in the stack and then using delete on it inside the destructor of stTst . If stTst is going to assume its p member points to a heap-allocated int and that it can delete the pointer, you'd need to change your code to:
void CTestdeleteDlg::OnButton1()
{
int* pK = new int;
*pK = 123;
stTst* p = new stTst[10];
p->p = pK;
delete[] p;
}
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hi,
int k=123;
stTst *p=new stTst[10];
p->p=&k;
delete[] p;
look k is allocated in the stack memory of the function OnButton1(). You are assigning the address of k to a class member variable and deleting it through dynamic deletion option. You can do that.
You cannot dynamically delete a variable which is allocated in the stack.
So you supposed not to delete the
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
|
i want to communicate with a device through LPT port, how can i do this using Win32(sdk) programming, plz help me.
|
|
|
|
|
|
how to install windows NT services?
d
|
|
|
|