Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Monday, March 26, 2012

How to run TSQL from vb net 2003

Hi All
I am upgrading a VB6 program to VB net 2003 which uses MSDE 2000 RelA
In vb6 I called a function...
retval = ExecCmd("osql -E -i """ & path & "\sql\CreateTramcars.sql""")
which ran the TSQL script against OSQL. The script basically created the
Database in MSDE then imports a heap of tables from Access 2000.
Private Function ExecCmd(cmdline$)
'used for MSDE to launch osql
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret&
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
' Start the shelled application:
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
'Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
What is the preferred method of running a TSQL script from VB Net 2003 using
sqlclient class?
Regards
Steve
hi Steve,
steve wrote:
> Hi All
> I am upgrading a VB6 program to VB net 2003 which uses MSDE 2000 RelA
> In vb6 I called a function...
> retval = ExecCmd("osql -E -i """ & path & "\sql\CreateTramcars.sql""")
> which ran the TSQL script against OSQL. The script basically created
> the Database in MSDE then imports a heap of tables from Access 2000.
> Private Function ExecCmd(cmdline$)
> 'used for MSDE to launch osql
> Dim proc As PROCESS_INFORMATION
> Dim start As STARTUPINFO
> Dim ret&
> ' Initialize the STARTUPINFO structure:
> start.cb = Len(start)
> ' Start the shelled application:
> ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
> NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
> 'Wait for the shelled application to finish:
> ret& = WaitForSingleObject(proc.hProcess, INFINITE)
> Call GetExitCodeProcess(proc.hProcess, ret&)
> Call CloseHandle(proc.hThread)
> Call CloseHandle(proc.hProcess)
> ExecCmd = ret&
> End Function
> What is the preferred method of running a TSQL script from VB Net
> 2003 using sqlclient class?
http://www.absistemi.it/permalink=tn169.ashx
this will use the very same feature with .Net..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.14.0 - DbaMgr ver 0.59.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Friday, March 23, 2012

How to run SQL Server Exp 2005

Dear friends

I have installed SQL Server Express Edition (55 mb).
Program >> Start >> MS SQL Server 2005 >> Configuration Tool ... this is what being displayed. This is my first use of MS Sql Server, before this I was using Oracle and after installation one could see Sql Plus from where the user can log in.

I am confused how to start SQL Server Expr 2005 edition and try some sql.
Please help me out..

Have a nice day
Ramniklal

Yo have to download a graphical management tool as a separate download: http://go.microsoft.com/fwlink/?LinkId=64064

--
SvenC

|||Thanks dear

Will get you back after downloading and using the graphical mgt. tool

bye n have a nice day
ramniklal|||

If you want to run commandline queries (I know that Oracle guys like that :-) ) you can use the OSQL.EXE (but this will be deprecated in the future) or the SQLCMD.EXE which is the successor of the OSQL.exe.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

sql

Wednesday, March 21, 2012

How to run a console program in ssis?

I need to execute a console program and capture its output.

What's the best way to do it?

(no xp_cmdshell approach)

Thanks,

The Execute Process task is used for this. Michael Entin just posted about this: http://blogs.msdn.com/michen/archive/2007/08/02/redirecting-output-of-execute-process-task.aspx