這兩天在做數據查詢的時候
於是懷疑是DataSet 表沒拖拽好
希望以後有人碰到同樣問題 goole 一下
**//// <summary>
/// Private helper method that execute a SqlCommand (that returns a resultset) against the specified SqlTransaction and SqlConnection
/// using the provided parameters
/// </summary>
/// <remarks>
/// e
/// FillDataset(conn
/// </remarks>
/// <param name=
/// <param name=
/// <param name=
/// <param name=
/// <param name=
/// <param name=
/// by a user defined name (probably the actual table name)
/// </param>
/// <param name=
private static void FillDataset(SqlConnection connection
string commandText
params SqlParameter[] commandParameters)
{
if( connection == null ) throw new ArgumentNullException(
if( dataSet == null ) throw new ArgumentNullException(
// Create a command and prepare it for execution
SqlCommand command = new SqlCommand();
bool mustCloseConnection = false;
PrepareCommand(command
// Create the DataAdapter & DataSet
using( SqlDataAdapter dataAdapter = new SqlDataAdapter(command) )
{
// Add the table mappings specified by the user
if (tableNames != null && tableNames
{
string tableName =
for (int index=
{
if( tableNames[index] == null || tableNames[index]
//
// 錯誤處
//dataAdapter
//tableName += (index +
//
// 修正Bug
dataAdapter
}
}
// Fill the DataSet using default values for DataTable names
dataAdapter
// Detach the SqlParameters from the command object
command
}
if( mustCloseConnection )
connection
}
From:http://tw.wingwit.com/Article/program/net/201311/12915.html