|
Hi....
I want to create dsn at runtime using mfc..
Is there any solution
plz help me!!!!!!
Thanks in advance
|
|
|
|
|
I don't think we can do this.
Note : Please give detail which type of DSN you want to create at run time.
I think u will be aware about System DSN,User DSN,File DSN
Regard's
Kaushik
|
|
|
|
|
I want to use System DSN..
|
|
|
|
|
Use SQLConfigDataSource()
Manish Rastogi
|
|
|
|
|
Hi
I use SQLConfigDataSource() API but it create User DSN & i want to create System DSN so plz help me.....
|
|
|
|
|
Thanks it has been done.............
|
|
|
|
|
But i have to done using Sql database so can it done using same API?
|
|
|
|
|
A DSN does not know/care about the underlying DBMS. The third argument is where you specify the type, and the fourth argument contains the details of that type.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The third argument is "Microsoft Access Driver (*.mdb)" then what should changes are required?
|
|
|
|
|
I wrote :
SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN,"Microsoft SQL Driver (*.sql)\0",(LPCSTR)szDesc))
sprintf(szDesc,"DSN=%s: DESCRIPTION=TOC support source: DBQ=%s: FIL=MicrosoftSQL: DEFAULTDIR=D:\\Database:: ","TestDB","root@localhost\\dtest.sql")
but it gives error so plzzzzzzzzz help me what should i changes?
|
|
|
|
|
meenakhisjoshi wrote: SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN,"Microsoft SQL Driver (*.sql)\0",(LPCSTR)szDesc))
Why the extra \0 character? This statement is missing a semicolon.
meenakhisjoshi wrote: sprintf(szDesc,"DSN=%s: DESCRIPTION=TOC support source: DBQ=%s: FIL=MicrosoftSQL: DEFAULTDIR=D:\\Database:: ","TestDB","root@localhost\\dtest.sql")
If you are using MFC, why not use a CString object rather than mess with sprintf() ? This statement is also missing a semicolon.
meenakhisjoshi wrote: but it gives error...
And that error would be?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In this '\0' just for termination of string
the error is
SQLConfigDataSource is return False.
Is any problem in that syntax
|
|
|
|
|
meenakhisjoshi wrote: In this '\0' just for termination of string
Which string literals already have one of.
meenakhisjoshi wrote: SQLConfigDataSource is return False.
So have you bothered to call SQLInstallerError() to find out why?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Use ODBC_ADD_SYS_DSN
Manish Rastogi
|
|
|
|
|
Hi
Is exists in c++ a function similar to DATEDIFF in SQL or VB
THANK
|
|
|
|
|
|
CompareFileTime is a win32 function that'll compare two FILETIME structs
|
|
|
|
|
Unfortunately, none of the two suggestion above will do what DATEDIFF does...
You need to separate the DATE part of your time value. You didn't say what data type you use for your date/time variables.
The easiest way, I think, is to convert both dates to COleDateTime (which wraps double representation of date/time), truncate the fractional part and simply subtract one value from another.
-----------------------------
Get trial copy of FeinViewer - an integrated GDI objects viewer for Microsoft Visual Studio .NET 2005 (8.0) Visual C++ Debugger, and other convenience and productivity tools for Microsoft Visual Studio .NET at at www.FeinSoftware.com
|
|
|
|
|
Hi all,
I would liek to know if it is possible to create dynamic structures? And if it is possible, how would one go about doing it?
Many Thanks
Regards,
The Code Project...Where men are made and legends are born
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
i think the only way is to use void* Pointer into your struct.
So you can store what-ever in your structure.
But the number of pointers must be specified in the code.
Good luck
|
|
|
|
|
Programm3r wrote: I would liek to know if it is possible to create dynamic structures?
What do you mean? Do you want to dynamically create statically declared structs?
If the answer is yes, then use the new operator. On the other hand, if the answer is no, please detail you request.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: What do you mean?
Well for example, instead of creating five structures, is it possible to create one structure that can dynamically cater for each of the five structs during run time.
Makes sense ?
Thanks for the response ...
Regards,
The Code Project...Where men are made and legends are born
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: is it possible to create one structure that can dynamically cater for each of the five structs during run time
Why don't you use a container (such as std::vector ) for your dynamically created structures?
(Maybe I haven't fully understood your requirements).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks for the info CPallini, never really used a std::vector before, but I'll give it a shot.
Thanks
Regards,
The Code Project...Where men are made and legends are born
Programm3r
My Blog: ^_^
|
|
|
|
|
You mean 5 different structures? , then you can't use vectors straight away. You can use vectors to grow itself dynamically but not different data struct types. May be you can cast everything to void* then push it inside the vector. I mean if you are talking about different structs.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|