本文整理汇总了C#中Query.SetInputParameterNames方法的典型用法代码示例。如果您正苦于以下问题:C# Query.SetInputParameterNames方法的具体用法?C# Query.SetInputParameterNames怎么用?C# Query.SetInputParameterNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.SetInputParameterNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DesignGrid
public bool DesignGrid(string strProcedureName, ref string strErr)
{
try
{
this.AutoGenerateColumns = false;
strProcName = strProcedureName;
Query objQuery = new Query();
if (ProcParamNames.Count > 0)
{
string[] arrStrProcParamNames = new string[ProcParamNames.Count];
string[] arrStrProcParamValues = new string[ProcParamNames.Count];
for (int i = 0; i < ProcParamNames.Count; i++)
{
arrStrProcParamNames[i] = ProcParamNames[i].ToString();
arrStrProcParamValues[i] = ProcParamValues[i].ToString();
}
objQuery.SetInputParameterNames(strProcedureName, arrStrProcParamNames);
objQuery.SetInputParameterValues(arrStrProcParamValues);
}
objQuery.SetOutputParameterNames(strProcedureName, "CRITERIA");
DataSet ds = objQuery.ExecuteQueryProcedure(strProcedureName);
dtReadOnlyGrid = ds.Tables[0].Copy();
ds.Dispose();
//Changing For New Component
//_BSource = new BindingSource(dtReadOnlyGrid, null);
intColCount = dtReadOnlyGrid.Columns.Count;
strColNames = new string[intColCount];
for (int i = 0; i < intColCount; i++)
strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName;
string[] strHeadings = new string[intColCount];
////**** Creating the Header text by replacing the Underscore(_)
////**** Symbol with the Space ( ).
clsLanguage objLang = new clsLanguage();
for (int i = 0; i < intColCount; i++)
{
strHeadings[i] = strColNames[i].Replace("_", " ");
if (strLangID != null && strColNames[i].IndexOf("MASK_") < 0)
{
if (strLangID.Length >= intColCount)
{
string strTmp = objLang.LanguageString(strLangID[i]);
if (strTmp == "*****")
strHeadings[i] = "** " + strHeadings[i];
else
strHeadings[i] = strTmp;
}
else
{
if (strLangID.Length > i)
{
string strTmp = objLang.LanguageString(strLangID[i]);
if (strTmp == "*****")
strHeadings[i] = "** " + strHeadings[i];
else
strHeadings[i] = strTmp;
}
else
{
strHeadings[i] = "** " + strHeadings[i];
}
}
}
else
{
strHeadings[i] = "** " + strHeadings[i];
}
}
if (objLang != null)
objLang.Dispose();
////**** If the Default design is false then setting Colors for that Grid
//this.reEntrent = true;
//Changing For New Component
// this.DataSource = dtReadOnlyGrid;
//this.DataSource = dtReadOnlyGrid;
//this.reEntrent = false;
if (SetDefault == true)
{
//DataGridViewCellStyle headerstyle=new DataGridViewCellStyle();
//headerstyle.BackColor= System.Drawing.Color.Linen;
//headerstyle.ForeColor=System.Drawing.Color.Navy;
//this.GridColor = System.Drawing.Color.Silver;
//this.ColumnHeadersDefaultCellStyle.ApplyStyle(headerstyle);
}
else
//.........这里部分代码省略.........
示例2: ExecuteProcedure
/// <summary>
/// Executes a procedure for populating the treegridview
/// </summary>
/// <param name="SQLProcName">Procedure Name/SQL query string</param>
/// <param name="isSQL">true if the supplied 'SQLProcName' if SQL query;else false</param>
/// <param name="strErrMsg">Error message to be returned</param>
/// <returns></returns>
private bool ExecuteProcedure(string SQLProcName, bool isSQL, ref string strErrMsg)
{
try
{
Query objQuery = new Query();
if (!isSQL)
{
string[] arrStrProcParamNames = new string[0];
string[] arrStrProcParamValues = new string[0];
if (ProcParamNames.Count - arlOutParam.Count > 0)
{
arrStrProcParamNames = new string[ProcParamNames.Count - arlOutParam.Count];
arrStrProcParamValues = new string[ProcParamNames.Count - arlOutParam.Count];
for (int i = 0; i < ProcParamNames.Count; i++)
{
if (ProcParamValues[i] != null)
{
arrStrProcParamNames[i] = ProcParamNames[i].ToString();
arrStrProcParamValues[i] = ProcParamValues[i].ToString();
}
}
objQuery.SetInputParameterNames(SQLProcName, arrStrProcParamNames);
objQuery.SetInputParameterValues(arrStrProcParamValues);
}
arrStrProcParamNames = new string[arlOutParam.Count];
arrStrProcParamValues = new string[arlOutParam.Count];
int iOutParamIndex = 0;
for (int i = 0; i < ProcParamNames.Count; i++)
{
if (ProcParamValues[i] == null)
{
arrStrProcParamNames[iOutParamIndex++] = ProcParamNames[i].ToString();
}
}
objQuery.SetOutputParameterNames(SQLProcName, arrStrProcParamNames);
dsSource = objQuery.ExecuteQueryProcedure(SQLProcName);
}
else
{
dsSource = objQuery.ExecuteQueryCommand(SQLProcName);
}
dtSource = dsSource.Tables[0].Copy();
dsSource.Dispose();
intColCount = dtSource.Columns.Count;
strColNames = new string[intColCount];
for (int i = 0; i < intColCount; i++)
strColNames[i] = dtSource.Columns[i].ColumnName;
if (isSQL == false)
{
strProcOutValue = new string[arlOutParam.Count];
for (int i = 0; i < arlOutParam.Count; i++)
{
strProcOutValue[i] = objQuery.GetOutputParameterValue(arlOutParam[i].ToString());
}
}
dtSource = dsSource.Tables[0];
dvSource = dtSource.DefaultView;
dvSource.AllowNew = false;
intTotalRowCount = dvSource.Count; //INDRANIL
//dtSource.Columns.Add("MASK_LOAD_COL_VALUE");
//for (int i = 0; i < dtSource.Rows.Count; i++)
// dtSource.Rows[i]["MASK_LOAD_COL_VALUE"] = "0";
intColCount = dtSource.Columns.Count - 1;
//MyGridTextBoxColumn._RowCount = dtSource.Rows.Count;
ChangeDataTable();
return true;
}
catch (Exception ex)
{
strErrMsg = ex.Message + " - " + ex.Source;
return false;
}
}
示例3: PopulateGrid
public bool PopulateGrid(ref string strErr)
{
try
{
Query objQuery = new Query();
string[] arrStrProcParamNames = new string[ProcParamNames.Count];
string[] arrStrProcParamValues = new string[ProcParamNames.Count];
for (int i = 0; i < ProcParamNames.Count; i++)
{
arrStrProcParamNames[i] = ProcParamNames[i].ToString();
arrStrProcParamValues[i] = ProcParamValues[i].ToString();
}
objQuery.SetInputParameterNames(strProcName, arrStrProcParamNames);
objQuery.SetInputParameterValues(arrStrProcParamValues);
objQuery.SetOutputParameterNames(strProcName, "CRITERIA");
DataSet ds = objQuery.ExecuteQueryProcedure(strProcName);
dtReadOnlyGrid = ds.Tables[0].Copy();
intColCount = dtReadOnlyGrid.Columns.Count;
strColNames = new string[intColCount];
for (int i = 0; i < intColCount; i++)
strColNames[i] = dtReadOnlyGrid.Columns[i].ColumnName;
// CurrencyManager cm = (CurrencyManager)this.BindingContext[this.DataSource];
//((DataView)cm.List).AllowNew = true;
//((DataView)cm.List).AllowNew = false;
this.DataBindings.Clear();
//this.Rows.Clear();
//this.AllowUserToAddRows = false;
this.reEntrent = true;
this.MultiSelect = false;
//this.DataSource = null;
this.DataSource = dtReadOnlyGrid;
this.reEntrent = false;
//this.AllowUserToAddRows = true;
//((DataView)cm.List).AllowNew = false;
ds.Dispose();
this.AutoSize = true;
RowCount = dtReadOnlyGrid.Rows.Count;
return true;
}
catch (Exception ex)
{
strErr = ex.Message + " - " + ex.Source;
return false;
}
}