Google to FTS Syntax Cheat Sheet
OPERATOR EXAMPLE | DESCRIPTION
|
nut | Searches for inflectional forms of the word nut |
crank arm crank AND arm | Searches for documents containing inflectional forms of the words crank AND arm crank and ann. The keyword AND is optional. |
tire OR air | Searches for documents containing inflectional forms of the words tire or air, |
“reflector bracket” | Performs a phrase search for the phrase "reflector bracket". |
hardware -bracket | Searches for documents containing inflectional forms of the word hardware but not the word bracket. |
+clamp | Searches for the word darn') without generating inflectional forms. |
~seat | Searches for thesaurus forms of the word seat |
Assemb* | Searches for words that begin with the prefix assemb |
. <washer nut> | Searches for documents that contain the words washer in close proximity to the word nut |
This is nice article
ReplyDelete#region Private
ReplyDelete///
/// Object for Logging
///
private static ILog logger = LogManager.GetLogger(typeof(DBConnectionManager));
///
/// Specifies the time when query was executed last time.
///
private static DateTime 1.lastExecutionTime = DateTime.Now;
///
/// Represent a command to database.
///
private SqlCommand sqlCmd;
///
/// Represent a connection to database.
///
private SqlConnection conn;
///
/// Represent a connection string.
///
private static string connection;
///
/// Represent a time out for connection.
///
private int timeOut;
///
/// Whether component is disposed or not
///
private bool disposed = false;
#endregion
2. # region Properties
///
/// Get Command Object
///
public SqlCommand SqlCmd
{
get
{
return sqlCmd;
}
}
///
/// Connection object to the database
///
public SqlConnection Conn
{
get
{
return conn;
}
set
{
conn = value;
}
}
///
/// get or set the database command time out value
///
public int TimeOut
{
get
{
return timeOut;
}
set
{
timeOut = value;
}
}
///
/// get/set Database Connection String
///
public string Connection
{
get
{
return connection;
}
set
{
connection = value;
}
}
#endregion
3. public static void SetDatabaseConnectionString(string connectionString)
ReplyDelete{
DBConnectionManager.connection = connectionString;
}
public void OpenConnection()
{
const string ProcName = "OpenConnection";
try
{
logger.Debug(ProcName + EnterProcedure);
if (conn == null || conn.State == ConnectionState.Closed || conn.State == ConnectionState.Broken
|| DateTime.Now.Subtract(lastExecutionTime).TotalMinutes > 30)
{
//open new connection
conn = new SqlConnection(connection);
conn.Open();
}
lastExecutionTime = DateTime.Now;
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
3.... public void CloseConnection()
ReplyDelete{
const string ProcName = "CloseConnection";
try
{
logger.Debug(ProcName + EnterProcedure);
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
public void CloseConnection(SqlConnection sqlConn)
{
const string ProcName = "CloseConnection() ";
try
{
logger.Debug(ProcName + EnterProcedure);
if (sqlConn != null && sqlConn.State == ConnectionState.Open)
sqlConn.Close();
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
3.2 public void AddParam(string paramName, SqlDbType paramType, Object paramValue, ParameterDirection direction, int size)
ReplyDelete{
const string ProcName = "AddParam";
try
{
logger.Debug(ProcName + EnterProcedure);
sqlCmd.Parameters.Add(CreateParameter(paramName, paramType, paramValue, direction, size));
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
3.3 public void AddParam(string paramName, string paramValue, int size)
ReplyDelete{
const string ProcName = "AddParam";
try
{
logger.Debug(ProcName + EnterProcedure);
sqlCmd.Parameters.Add(CreateParameter(paramName, SqlDbType.VarChar, paramValue, ParameterDirection.Input, size));
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
public void AddParam(string paramName, int paramValue, int size)
{
const string ProcName = "AddParam";
try
{
sqlCmd.Parameters.Add(CreateParameter(paramName, SqlDbType.Int, paramValue, ParameterDirection.Input, size));
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
3.4 public void AddParam(string paramName, DateTime? paramValue, int size, bool treatForNull)
ReplyDelete{
const string ProcName = "AddParam";
try
{
object parameterValue;
if (paramValue == null)
{
parameterValue = DBNull.Value;
}
else
{
parameterValue = paramValue;
}
sqlCmd.Parameters.Add(CreateParameter(paramName, SqlDbType.DateTime,
paramValue, ParameterDirection.Input, size, treatForNull));
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
public void AddOutputParameter(string paramName, int size)
{
const string ProcName = "AddOutputParameter";
try
{
sqlCmd.Parameters.Add(CreateParameter(paramName, SqlDbType.VarChar, null, ParameterDirection.Output, size));
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
public DataSet GetFolderByStatus(int statusID, int updateStatus, int projectUpdateStatus, string machineName)
ReplyDelete{
const string ProcName = "GetProjectByStatus";
try
{
logger.Debug(ProcName + EnterProcedure);
CreateSqlCommand(GetFolderByStatusProcedure);
AddParam("@StatusID", statusID, 4);
AddParam("@UpdateStatusID",updateStatus,4);
AddParam("@ProjectUpdateStatus", projectUpdateStatus, 4);
AddParam("@MachineName", machineName, 100);
ExecuteSQL();
return GetDataset();
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}
public DataSet ProjectLoad(int projectID)
ReplyDelete{
const string ProcName = "ProjectLoad";
try
{
logger.Debug(ProcName + EnterProcedure);
CreateSqlCommand(ProjectLoadProcedure);
AddParam("@projectId", projectID, 4);
ExecuteSQL();
return GetDataset();
}
catch (Exception ex)
{
logger.Error(ProcName + ErrorOccured, ex);
throw;
}
finally
{
logger.Debug(ProcName + ExitProcedure);
}
}