C2017-003: Support SQL Server for storing of Referenced Object data
This commit is contained in:
@@ -36,6 +36,7 @@ using System;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using Microsoft.Data.Odbc;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace DBEncapsulation
|
||||
{
|
||||
@@ -202,4 +203,62 @@ namespace DBEncapsulation
|
||||
myCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
// C2017-003: support for sql server
|
||||
public class SQLEncap : DBEncapsulate
|
||||
{
|
||||
public SqlConnection mySqlConnection;
|
||||
SqlCommand myCommand;
|
||||
SqlDataReader myReader;
|
||||
public override void Connection(string strconnect)
|
||||
{
|
||||
mySqlConnection = new SqlConnection(strconnect);
|
||||
}
|
||||
public override void OpenConnection()
|
||||
{
|
||||
mySqlConnection.Open();
|
||||
}
|
||||
public override void CloseConnection()
|
||||
{
|
||||
mySqlConnection.Close();
|
||||
}
|
||||
public override void Command(string strCommand)
|
||||
{
|
||||
myCommand = new SqlCommand(strCommand, mySqlConnection);
|
||||
}
|
||||
public override void CommandDispose()
|
||||
{
|
||||
myCommand.Dispose();
|
||||
}
|
||||
public override bool Reader()
|
||||
{
|
||||
myReader = myCommand.ExecuteReader();
|
||||
if (myReader == null)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
public override void ReaderClose()
|
||||
{
|
||||
myReader.Close();
|
||||
}
|
||||
public override bool Read()
|
||||
{
|
||||
return (myReader.Read());
|
||||
}
|
||||
public override string GetString(int num)
|
||||
{
|
||||
if (myReader.IsDBNull(num) == false)
|
||||
return (myReader.GetString(num));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public override int GetInt32(int num)
|
||||
{
|
||||
return (myReader.GetInt32(num));
|
||||
}
|
||||
public override void NonQuery()
|
||||
{
|
||||
myCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user