How to execute a * .sql file in .CS to create a database

zhaozj2021-02-16  51

There are references in the project SQLDMO added sqldmo SQLDMO.SQLServer2 sqlserver = new SQLDMO.SQLServer2Class (); sqlserver.Connect ( "localhost", "sa", ""); SQLDMO.Databases mydbs = sqlserver.Databases; SQLDMO.Database mydb = New SqldMo.databaseClass ();

Mydb = (SqldMo.database) MyDBS.Item ("Test", "SA"); System.io.StreamReader S = New System.io.StreamReader ("E: /XP/testsqldmo/a.sql"); String SQL = S.ReadToEnd ();

Mydb.executeimmediate (sql, sqldmo.sqldmo_exec_type.sqldmoexec_default, sql.length);

转载请注明原文地址:https://www.9cbs.com/read-21094.html

New Post(0)