|
I have a SQL server and I would like to be able to write an installer to create the database for the administrator. Currently the admin has to run the query analyzer and open the .sql file that creates the database, all the tables and the login I provide and execute the query. How do you go about executing this type of query from an external program?
|
|
|
|
|
I have done this a couple of times.
Go in to the SQL Server admin, and script yopur database.
Then you get a SQL file with a lot of SQL "Queries" in. After each query there is a "GO" statement.
Just take each of those queries, without the GO part, and execute them from your installer.
There's a lot of articles here on CodeProject about how to connect to a database and execute SQL Queries.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi all,
I need to access some databases. I know what ADO and ODBC can do as far as I use user defined Queries. The question is waht about stored procedures.
Can ADO or ODBC or both access them?
Thanks in Advance.
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
Yes, the two tecnologis can execute Stored Procedures.
ADO has the command Execute, or Open, depending of the Stored returns Rows.
And ODBC has SQLExecuteDirect, or SQLExecute
Cheers!!!
Carlos Antollini.
|
|
|
|
|
You also have the choice of using OLE DB Consumers, the prefered way in Visual C++ when using OLE DB.
|
|
|
|
|
Does anyone know of any articles or information related to returning a recordset from ADO and C++ to a scripting or vb client?
Thanks alot!
Jon
|
|
|
|
|
You can use, ADO from VB.
ADO is a COM object, is for that You can use ADo from VB.
Cheers.
Carlos Antollini.
|
|
|
|
|
I know I can use ADO from VB, that wasn't my question, but thanks for trying.
I have a dcom dll that I want to return an ado recordset from and make it available to vb or scripting clients.
Anyone have any info or links to articles that are related to my problem? I will be most appreciative!
Thanks!
|
|
|
|
|
I understand, You want to make a COM Dll that returns a ADO Recordset?
Regards
Carlos Antollini.
|
|
|
|
|
Yes, that's correct. I thought I had seen an article or some info on how to do it somewhere. I may be mistaken however.
I want to return a recordset from a COM/DCOM dll written in Visual C++ to a scripting or VB client.
Thanks Much!
|
|
|
|
|
You need to build a ATL Project.
look Into the site, Info About ATL and ADO.
If you don't find nothing, I can send you a sample, of Using ADO into ATL Project.
I Work every day with that Kind of Project.
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Cool, I found some info here and on microsoft's site in regards to doing this with ATL.
Thanks!!
|
|
|
|
|
see article at
http://www.codeproject.com/atl/atl_ado.asp
|
|
|
|
|
Hi
I think what you want to do is almost the same as what the RDS.DataFactory can do for you.
If you need to extend the functionality - you can create your own based on the DataFactory.
Search for RDS in the MSDN
|
|
|
|
|
I installed .Net,and I found the component writed with VB was correct while debug step by step,then I make the dll.But it does not work correct.(In one method of this component ,I called one function of another dll just for unzip files.)
If this is caused by .net?
sandos
|
|
|
|
|
I am building an application that will require a database to store information. I am wondering what ones are available for me to use.
I like the ease of distribution of Access, just dump the file on the target machine make sure the newest MDAC is installed and of you go with ODBC calls or whatever. Problem is when I attempted to setup a database I couldn't create table or field names as whatever I liked.
I could name evrything to anything in SQL Server but it requires the files and MSDE on the target machine to run. This is annoying.
Is there a database out there that allows me to create table and fields names to anything I like, doesn't require something like MSDE to access it programatically? I wouldn't mind free as I may want to create some application in my personal time for free distribution and I don't want to break the bank doing it.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
Why couldn't you name your tables and fields in Access (=Jet) as you like? As far as I know there is little difference between Jet and SQL Server?
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Have to look into it again, I tried a couple of months ago and seemed to get locked into a wizard interface that kept giving me choices of existing table and field names. Then got the sh*ts and moved onto SQL Server, just think it is overkill for any litle dinky stuff I will work on in my own time at the moment.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
Problem is when I attempted to setup a database I couldn't create table or field names as whatever I liked.
Did you try with Dao or with ADOX?.
I can to do that.....
Try with ADOX or with CDAOWorkspace, CADOTableDef, etc.
If you need samples, please let me Know.....
Best Regards!!!!
Carlos Antollini.
|
|
|
|
|
My descriptive powers of the written word have failed me again, I'm a moron. What I was trying to say was -
When creating a database from within Access itself I couldn't just name the tables and fields they contained anything I wanted, a wizard kept getting in my road and pissed me off so much I went to SQL Server which was overkill.
I will pul my head in, try all this again and learn to express my question better next time.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
Hello !
Which is better ?
*** Create one ADOConnection at start point, and use it globally in program
or
*** Create an ADOConnection whenever and everywhere needed
tanks
|
|
|
|
|
Create an ADOConnection whenever it's needed.
|
|
|
|
|
Hello Gerald Schwab ...
your answer is good!, but Creating an ADOConnection whenever it's need, may slow down my application, isn't it ?
tanks!
|
|
|
|
|
Is better to use the adoconnection like a global variable for your application, but you must open the adoconnection when you need, and leaving that connection open, for future use, and closing the connection when you close the Applictaion. But if your applictation need to use the connection every a long time, is better open the connection every time that you needm, but always leaving the connection like a global function.
Cheers....
Carlos Antollini.
|
|
|
|
|
Hello Carlos Antollini ....
your answer is good, too !
but, I have problem with that when I use Transaction with Option_Explicit set to ON. In some cases i should restart my application.
|
|
|
|