|
I think it would not be user friendly to require my users to set the data source before they can use my application.
|
|
|
|
|
It is so easy to set data sourse in your program
CString str,DBName;;<br />
DBName = "Program path"+"\\DBname.mdb";<br />
str.Format("DSN=Chapar;DBQ=%s;READONLY=FALSE;EXCLUSIVE=FALSE;",DBName);<br />
SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver (*.mdb)",str);
& to fined your program path use something like this:
GetModuleFileName(NULL,m_CurrentPath.GetBuffer(256),256);<br />
m_CurrentPath.ReleaseBuffer();<br />
m_CurrentPath.Delete(m_CurrentPath.ReverseFind('\\'),m_CurrentPath.GetLength()-m_CurrentPath.ReverseFind('\\'));
Iman Ghasrfakhri
|
|
|
|
|
Thanks Ghasrfakhri.
So I set it when my program is used for the first time?
|
|
|
|
|
CBasicNet wrote:
So I set it when my program is used for the first time?
Yes, or you can use a DSN-less connection.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
Thanks toxcct! I have seem that article before.
I would like to master ADO first before using a wrapper class which may hides some of the details from me.
|
|
|
|
|
i believe ADO have no class in the "constructor" classes...
that's why i fully use Mr Antolini's !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Either ODBC or ADO. But I prefer ADO.
John
|
|
|
|
|
Can you give me some reasons for your preference?
|
|
|
|
|
CBasicNet wrote:
Can you give me some reasons for your preference?
I use ADO for everything.
Down Sides to ADO,
-I guess it can be a memory hog (I haven’t see this problem personally)
-Poorly documented, most of the documentation was written for VB, if you know that language than translating it shouldn’t be too difficult.
-ADO is COM based; in C++ working with COM can be a pain.
Positives
-Flexibility, ADO can connect to just about every data source you can think of. Excel, Access dbs, delimited files, SQL server, Oracle server, even LDAP (as memory serves)
-Changing data sources is easy enough just change the connection string.
-Dumping data from the data connection is extremely easy, ADO natively supports dumping data to an XML file, or you can execute a query that will dump data to a file. RE
objDB.Execute _
"SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
"].[" & strWorksheet & "] FROM " & "[" & strTable & "]"
objDB.Close
-It supports calling stored procedures or strait queries.
-Changing the location of the where the data is; is a matter of changing the database connection.
That’s all I can think of for the time being. Before you start using someone else’s class I suggest hacking around with ADO. It’s very powerful but comes at a cost (steep learning curve).
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I have very good experience with OLEDB templates and ATL.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Are you a glutton for punishment or OLEDB templates is different from the OLEDB I have heard of?
|
|
|
|
|
Are you using OLEDB through simple-to-use wrapper classes or you are using it 'raw'?
|
|
|
|
|
|
ODBC is more standarized and it would permit to change your database platform with only changing the connection string.
Marc Soleda.
|
|
|
|
|
hiho@ll
i need to convert a simple javascript i've found which generates a checksum to C
because i want to use it in a c prog
btw. i want to use this exact checksum code, so trieing another checksum algorithm isn't an option
here is only one line of code where i think the problem occures
i'll post the whole code as a reply so you can test it if you want
javascript:
<br />
c[r(i,3)]=(c[r(i,3)]-c[r(i+1,3)]-j)^(r(i,3)==1?j<<s[i]:j>>>s[i]);<br />
C:
<br />
c[r(i,3.0)]=(c[r(i,3.0)]-c[r(i+1,3.0)]-j)^(r(i,3.0)==1?j<<s[i]:j>>s[i]);<br />
r is defined as this:
<br />
#define r(x,y) (long long int)(floor(((x)/(y)-floor((x)/(y)))*(y)+0.1))<br />
and for testing you can use c as the following array:
<br />
long long int c[]={0x9E3779B9,0x9E3779B9,0xE6359A60};<br />
the problem is that i get wrong values within the C code
but the javascript code works
another problem was Visual Studio!!
i got complete different values for the whole code using visual studio
using the same code on Linux (i used cygwin) got me right values (for some part of the whole code)
don't know what the problem is/was but neither Visual Studio nor Linux got the one line described above work
i get wrong values
anybody knows the right conversion of the javascript code to C code?
thx@ll
|
|
|
|
|
the javascript:
<br />
<html><br />
<head><title></title><br />
<script type="text/javascript"><br />
<br />
function r(x,y){<br />
return Math.floor((x/y-Math.floor(x/y))*y+.1);<br />
}<br />
<br />
function m(c){<br />
var i,j,s=[13,8,13,12,16,5,3,10,15];<br />
for(i=0;i<9;i+=1){<br />
j=c[r(i+2,3)];<br />
c[r(i,3)]=(c[r(i,3)]-c[r(i+1,3)]-j)^(r(i,3)==1?j<<s[i]:j>>>s[i]);<br />
}<br />
}<br />
<br />
function getURL(url){<br />
url='info:'+url;<br />
var c=[0x9E3779B9,0x9E3779B9,0xE6359A60],i,j,k=0,l;<br />
for(l=url.length;l>=12;l-=12){<br />
for(i=0;i<16;i++){<br />
j=k+i;<br />
c[Math.floor(i/4)]+=url.charCodeAt(j)<<(r(j,4)*8);<br />
}<br />
m(c);<br />
k+=12;<br />
}<br />
c[2]+=url.length;<br />
for(i=l;i>0;i--)<br />
c[Math.floor((i-1)/4)]+=url.charCodeAt(k+i-1)<<(r(i-1,4)+(i>8?1:0))*8;<br />
m(c);<br />
return'6'+c[2];<br />
}<br />
<br />
</script><br />
</head><br />
<body><br />
<table><br />
<tr><br />
<td><br />
String:<br />
</td><br />
<td><br />
<input type="text" name="hmm"></input><br />
</td><br />
</tr><br />
<tr><br />
<td><br />
Checksum<br />
</td><br />
<td><br />
<input type="text" name="checksum" ></input><br />
</td><br />
</tr><br />
<table><br />
<input type="button" onClick="javascript:checksum.value=getURL(hmm.value);" value="Generate Checksum"><br />
</body><br />
</html><br />
the C code i already have:
<br />
#include <math.h><br />
#include <string.h><br />
#include <limits.h><br />
#include <stdio.h><br />
<br />
#define r(x,y) (long long int)(floor(((x)/(y)-floor((x)/(y)))*(y)+0.1))<br />
<br />
void m(long long int *c);<br />
void getUrl(char *tmp);<br />
void printc(long long int *c);<br />
<br />
void printc(long long int *c){<br />
for(long long int i=0;i<3;i++)<br />
printf("%lld ",c[i]);<br />
printf("\n");<br />
}<br />
<br />
int main(int argc, char **argv)<br />
{<br />
getUrl("http://fabmail.de/"); <br />
fgetc(stdin);<br />
return 0;<br />
}<br />
<br />
void m(long long int *c){<br />
long long int i,j,s[]={13,8,13,12,16,5,3,10,15};<br />
printc(c);<br />
for(i=0;i<9;i++){<br />
j=c[r(i+2,3.0)];<br />
c[r(i,3.0)]=(c[r(i,3.0)]-c[r(i+1,3.0)]-j)^(r(i,3.0)==1?j<<s[i]:j>>s[i]);<br />
}<br />
}<br />
<br />
void getUrl(char *tmp){<br />
char url[2048]={0};<br />
char ergebnis[1024]={0};<br />
if(tmp==NULL || strlen(tmp)>2084-6){<br />
return;<br />
}<br />
sprintf(url,"info:%s",tmp);<br />
long long int c[]={0x9E3779B9,0x9E3779B9,0xE6359A60};<br />
long long int i,j,k=0,l;<br />
for(l=(long long int)strlen(url);l>=12;l-=12){<br />
for(i=0;i<16;i++){<br />
j=k+i;<br />
c[(int)floor(i/4.0)]+=url[j]<<(r(j,4.0)*8);<br />
}<br />
m(c);<br />
k+=12;<br />
}<br />
c[2]+=(long long int)strlen(url);<br />
for(i=l;i>0;i--)<br />
c[(int)floor((i-1)/4.0)]+=url[(k+i-1)]<<(r(i-1,4.0)+(i>8?1:0))*8;<br />
m(c);<br />
sprintf(ergebnis,"6%lld",c[2]);<br />
printf("%s\n",ergebnis);<br />
}<br />
int the C code the problem is in the m(c); function
but i don't know what's wrong
-- modified at 9:10 Sunday 2nd October, 2005
|
|
|
|
|
Hello,
I am new in VS.Net and i have some knowledge about C#.Net. Now i want to learn VC++.Net by self study, so if any one tell me some free resource and startkit or any web which give trainning from start.
Thanks and regards,
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Hi
I thinck it is not the time to start VC++,It seem Microsoft does not need (&want) C++ programmers any more, I tring to forget VC++ ,but I ...
shame on Microsoft.
Iman Ghasrfakhri
|
|
|
|
|
Tnis is totally wrong.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What microsoft did in 4-5 yearfor VC.NET ?
Managed Codes ,CLI or .... !?!?!
I don't know what microsoft wana to do about VC++ programmers
Iman Ghasrfakhri
|
|
|
|
|
Ghasrfakhri wrote:
What microsoft did in 4-5 yearfor VC.NET ?
Managed Codes ,CLI or .... !?!?!
and why do you think MFC is still supported ?
what you say is totaly wrong, and even if Microsoft wouldn't need C++ programmer, some entreprises do !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
1. Standards conformance
2. new MFC
3. What do you think C# and VB.NET are written in ?
4. New Managed C++, if you want it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ghasrfakhri wrote:
It seem Microsoft does not need (&want) C++ programmers any more...
Is this just your opinion, or do you have some factual data to back this claim up with?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
No direct factual data, But answer this Question what microsoft do for C++ programmers in .Net?
Iman Ghasrfakhri
|
|
|
|
|