public TestSqlServerUtil() { string conn = "server=.;Integrated Security=SSPI;database=EmployeeManagement"; this.ssu = new SqlServerUtil(conn); this.ssu.Open(); }
private void btnRefreshServer_Click(object sender, EventArgs e) { string current_server = txtServer.Text; string[] servers = SqlServerUtil.getServers(); txtServer.Items.Clear(); try { txtServer.Items.AddRange(servers); } catch { } txtServer.Text = current_server; }
public static DataSet GetDataSet(string databaseName, CommandType cmdType, string cmdText) { switch (NameTypeList[databaseName].ToLower()) { case "sqlserver": return(SqlServerUtil.GetDataSet(NameConnStrList[databaseName], cmdType, cmdText)); case "mysql": return(MySqlUtil.GetDataSet(NameConnStrList[databaseName], cmdType, cmdText)); case "oracle": return(OracleUtil.GetDataSet(NameConnStrList[databaseName], cmdType, cmdText)); default: return(null); } }
public static int ExecuteNonQuery(string databaseName, CommandType cmdType, string cmdText) { switch (NameTypeList[databaseName].ToLower()) { case "sqlserver": return(SqlServerUtil.ExecuteNonQuery(NameConnStrList[databaseName], cmdType, cmdText)); case "mysql": return(MySqlUtil.ExecuteNonQuery(NameConnStrList[databaseName], cmdType, cmdText)); case "oracle": return(OracleUtil.ExecuteNonQuery(NameConnStrList[databaseName], cmdType, cmdText)); default: return(-1); } }
private void btnRefreshDB_Click(object sender, EventArgs e) { string current_database = txtDatabase.Text; DBConnection conn = new DBConnection(); conn.db_type = DBType.SqlServer; conn.server_name = txtServer.Text; conn.user_name = txtUserName.Text; conn.password = txtPassword.Text; conn.refreshConnectionString(); txtDatabase.Items.Clear(); string[] databases = SqlServerUtil.getDatabases(conn); try { txtDatabase.Items.AddRange(databases); } catch { } txtDatabase.Text = current_database; }