本文整理汇总了C#中System.Data.OleDb.OleDbDataReader.NextResult方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbDataReader.NextResult方法的具体用法?C# OleDbDataReader.NextResult怎么用?C# OleDbDataReader.NextResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbDataReader
的用法示例。
在下文中一共展示了OleDbDataReader.NextResult方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteReaderInternal
private OleDbDataReader ExecuteReaderInternal(CommandBehavior behavior, string method) {
OleDbDataReader dataReader = null;
OleDbException nextResultsFailure = null;
int state = ODB.InternalStateClosed;
try {
ValidateConnectionAndTransaction(method);
if (0 != (CommandBehavior.SingleRow & behavior)) {
// CommandBehavior.SingleRow implies CommandBehavior.SingleResult
behavior |= CommandBehavior.SingleResult;
}
object executeResult;
int resultType;
switch(CommandType) {
case 0: // uninitialized CommandType.Text
case CommandType.Text:
case CommandType.StoredProcedure:
resultType = ExecuteCommand(behavior, out executeResult);
break;
case CommandType.TableDirect:
resultType = ExecuteTableDirect(behavior, out executeResult);
break;
default:
throw ADP.InvalidCommandType(CommandType);
}
if (_executeQuery) {
try {
dataReader = new OleDbDataReader(_connection, this, 0, this.commandBehavior);
switch(resultType) {
case ODB.ExecutedIMultipleResults:
dataReader.InitializeIMultipleResults(executeResult);
dataReader.NextResult();
break;
case ODB.ExecutedIRowset:
dataReader.InitializeIRowset(executeResult, ChapterHandle.DB_NULL_HCHAPTER, _recordsAffected);
dataReader.BuildMetaInfo();
dataReader.HasRowsRead();
break;
case ODB.ExecutedIRow:
dataReader.InitializeIRow(executeResult, _recordsAffected);
dataReader.BuildMetaInfo();
break;
case ODB.PrepareICommandText:
if (!_isPrepared) {
PrepareCommandText(2);
}
OleDbDataReader.GenerateSchemaTable(dataReader, _icommandText, behavior);
break;
default:
Debug.Assert(false, "ExecuteReaderInternal: unknown result type");
break;
}
executeResult = null;
_hasDataReader = true;
_connection.AddWeakReference(dataReader, OleDbReferenceCollection.DataReaderTag);
// command stays in the executing state until the connection
// has a datareader to track for it being closed
state = ODB.InternalStateOpen; // MDAC 72655
}
finally {
if (ODB.InternalStateOpen != state) {
this.canceling = true;
if (null != dataReader) {
((IDisposable) dataReader).Dispose();
dataReader = null;
}
}
}
Debug.Assert(null != dataReader, "ExecuteReader should never return a null DataReader");
}
else { // optimized code path for ExecuteNonQuery to not create a OleDbDataReader object
try {
if (ODB.ExecutedIMultipleResults == resultType) {
UnsafeNativeMethods.IMultipleResults multipleResults = (UnsafeNativeMethods.IMultipleResults) executeResult;
// may cause a Connection.ResetState which closes connection
nextResultsFailure = OleDbDataReader.NextResults(multipleResults, _connection, this, out _recordsAffected);
}
}
finally {
try {
if (null != executeResult) {
Marshal.ReleaseComObject(executeResult);
executeResult = null;
}
CloseFromDataReader(ParameterBindings);
}
catch(Exception e) {
//
if (!ADP.IsCatchableExceptionType(e)) {
throw;
}
if (null != nextResultsFailure) {
//.........这里部分代码省略.........
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Request["acao"] == "gravavideo")
{
gravavideo();
Response.Redirect("galeria-geral.aspx?sucesso=2&alert=Seu video foi enviado com sucesso e passará pelo processo de moderação dos administradores do Projeto Brincadeiras Musicais da Palavra Cantada. Agradecemos a sua participação!");
}
switch (Convert.ToInt32(Request["sucesso"]))
{
case 1:
fotodiv.InnerHtml = "<p class='pAvisoGaleria'>Sua foto foi enviada com sucesso e passará pelo processo de moderação dos administradores do Projeto Brincadeiras Musicais da Palavra Cantada. Agradecemos a sua participação!</p>";
fotodiv.InnerHtml += "<button class=\"btn_back up_forum\" style=\"margin-top: 20px; margin-bottom: 20px; cursor: pointer;\" onclick=\"location.href='/galeria-colaborativa'; return false;\">Voltar</button>";
break;
case 2:
videodiv.InnerHtml = "<p class='pAvisoGaleria'>Seu vídeo foi enviado com sucesso e passará pelo processo de moderação dos administradores do Projeto Brincadeiras Musicais da Palavra Cantada. Agradecemos a sua participação!</p>";
videodiv.InnerHtml += "<button class=\"btn_back up_forum\" style=\"margin-top: 20px; margin-bottom: 20px; cursor: pointer;\" onclick=\"location.href='/galeria-colaborativa'; return false;\">Voltar</button>";
break;
default:
break;
}
rsGaleria = objBD.ExecutaSQL("EXEC psGaleriaColaborativa " + Session["redeID"]);
if (rsGaleria == null) { throw new Exception(); }
if (rsGaleria.HasRows)
{
while (rsGaleria.Read())
{
ulFotos.InnerHtml += "<li><a href=\"/upload/imagens/galeriacolaborativa/" + rsGaleria["COF_IMAGEM"] + "\">" +
"<img src=\"/upload/imagens/galeriacolaborativa/thumb-" + rsGaleria["COF_IMAGEM"] + "\" alt=\" " + rsGaleria["COF_LEGENDA"] + "\"></a>" +
"<p>:: " + rsGaleria["COF_LEGENDA"] + " ::</p>" +
"</li>";
}
}
rsGaleria.NextResult();
if (rsGaleria.HasRows)
{
while (rsGaleria.Read())
{
ulVideos.InnerHtml += "<li class=\"\" style=\"width: 196px;\"><a href=\"" + rsGaleria["COV_VIDEO_ID"] + "\">" +
"<img src=\"http://i.ytimg.com/vi/" + rsGaleria["COV_VIDEO_ID"] + "/mqdefault.jpg\" alt=\"" + rsGaleria["COV_TITULO"] + "\">" +
"</a>" +
"<p>:: " + rsGaleria["COV_TITULO"] + " ::</p>" +
"<span>" + rsGaleria["COV_DESCRICAO"].ToString() + "</span>" +
"</li>";
}
}
rsGaleria.NextResult();
if (rsGaleria.HasRows)
{
rsGaleria.Read();
nomerede1.InnerText = rsGaleria["RED_TITULO"].ToString();
nomerede2.InnerText = rsGaleria["RED_TITULO"].ToString();
}
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
Session["usuUsuario"].ToString();
}
catch (Exception)
{
Response.Write("<script>alert('Desculpe... Você não pode vizualizar perfis enquanto estiver deslogado. Por favor efetue login e tente novamente.'); window.history.back();</script>");
Response.End();
}
rsPerfil = objBD.ExecutaSQL("EXEC PerfilUsuarioPorUsername '" + Request["usuario"]+ "'");
if (rsPerfil == null) { Response.Redirect("./default.aspx"); }
if (rsPerfil.HasRows)
{
rsPerfil.Read();
if (Session["usuID"].ToString() == rsPerfil["USU_ID"].ToString()) { Response.Redirect("../meu-perfil/" + Request["usuario"]); Response.End(); }
if (Session["redeID"].ToString() != rsPerfil["RED_ID"].ToString()) { Response.Redirect("../default.aspx"); Response.End(); }
nomeusuario.InnerText = rsPerfil["USU_NOME"].ToString();
nomeusuario1.InnerText = rsPerfil["USU_NOME"].ToString();
regiao.InnerText = rsPerfil["USU_REGIAO"].ToString();
biografia.InnerText = rsPerfil["USU_BIOGRAFIA"].ToString();
foto.Attributes.Add("src", "upload/imagens/usuarios/" + rsPerfil["USU_FOTO"].ToString());
foto_outro.Attributes.Add("src", "upload/imagens/usuario/galeria/thumb-" + rsPerfil["USU_ULTIMAFOTO"].ToString());
video_outro.Attributes.Add("src", rsPerfil["USU_ULTIMOVIDEO"].ToString());
if (rsPerfil["USU_ULTIMAFOTO"].ToString().Length < 1){foto_outro.Attributes.Add("style", "display: none;");}
if (rsPerfil["USU_ULTIMOVIDEO"].ToString().Length < 1) { video_outro.Attributes.Add("style", "display: none;"); }
if (rsPerfil["USU_ULTIMAFOTO"].ToString().Length < 1 && rsPerfil["USU_ULTIMOVIDEO"].ToString().Length < 1)
{
img_lateral_perfil.InnerHtml = "Sem vídeos e fotos para exibir no momento!";
}
linkfotos.Attributes.Add("href","perfil/fotos/" + rsPerfil["USU_USUARIO"]);
linkvideos.Attributes.Add("href", "perfil/videos/" + rsPerfil["USU_USUARIO"]);
linkblog.Attributes.Add("href", "perfil/blog/" + rsPerfil["USU_USUARIO"]);
}
rsPerfil.NextResult();
posts.InnerHtml = "";
if (rsPerfil.HasRows)
{
while (rsPerfil.Read())
{
posts.InnerHtml += "<li>" +
"<p class=\"titu_post_home\"><a href=\"post/post-aberto-3\">" + rsPerfil["POS_TITULO"] + "</a></p>" +
"<p class=\"desc_post_home\"><a href=\"post/post-aberto-3\">" + objUtils.CortarString(true, 90, rsPerfil["POS_TEXTO"].ToString()) + "</a></p>" +
"<a href=\"post/" + objUtils.GerarURLAmigavel(rsPerfil["POS_TITULO"].ToString()) + "\" class=\"btn\">LEIA MAIS</a> </li>";
}
}
rsPerfil.NextResult();
if (rsPerfil.HasRows)
{
rsPerfil.Read();
if (Convert.ToInt16(rsPerfil["TOTAL_LOGIN"]) > 2)
{
liDedicado.Attributes.Add("class", "ativo");
imgDedicado.Attributes.Add("src", "/images/medalha_ok.png");
}
if (Convert.ToInt16(rsPerfil["TOTAL_POST_BLOG"]) > 2)
{
liBlogueiro.Attributes.Add("class", "ativo");
imgBlogueiro.Attributes.Add("src", "/images/medalha_ok.png");
}
if (Convert.ToInt16(rsPerfil["TOTAL_FOTOS"]) > 2)
{
liFotografo.Attributes.Add("class", "ativo");
imgFotografo.Attributes.Add("src", "/images/medalha_ok.png");
}
if (Convert.ToInt16(rsPerfil["TOTAL_VIDEOS"]) > 2)
{
liProdutor.Attributes.Add("class", "ativo");
imgProdutor.Attributes.Add("src", "/images/medalha_ok.png");
}
}
rsPerfil.Close();
rsPerfil.Dispose();
}
示例4: PopularTabelas
public void PopularTabelas()
{
rsListar = objBD.ExecutaSQL("EXEC site_psCriacoesDocumentadas '" + Session["redeID"] + "' ");
if (rsListar == null)
{
throw new Exception();
}
tbAtiva.InnerHtml += "<table class=\"tabela\">";
tbAtiva.InnerHtml += " <tr>";
tbAtiva.InnerHtml += " <th style='min-width: 242px;'>Proposta</th>";
tbAtiva.InnerHtml += " <th style='min-width: 65px;'>Prazo</th>";
tbAtiva.InnerHtml += " <th>Relatos</th>";
tbAtiva.InnerHtml += " <th>Visualizar</th>";
tbAtiva.InnerHtml += " </tr>";
if (rsListar.HasRows)
{
while (rsListar.Read())
{
tbAtiva.InnerHtml += " <tr>";
tbAtiva.InnerHtml += " <td>" + rsListar["CDO_TAREFA"] + "</td>";
tbAtiva.InnerHtml += " <td>" + rsListar["CDO_DATA"] + "</td>";
tbAtiva.InnerHtml += " <td>" + rsListar["TOTAL_RELATOS"] + "</td>";
tbAtiva.InnerHtml += " <td><a href=\"/tarefa-ativa/" + rsListar["CDO_ID"] + "\">Visualizar Proposta</a></td>";
tbAtiva.InnerHtml += " </tr>";
}
tbAtiva.InnerHtml += "</table>";
//Próxima tabela
rsListar.NextResult();
tbArquivada.InnerHtml += "<table class=\"tabela2\">";
tbArquivada.InnerHtml += " <tr>";
tbArquivada.InnerHtml += " <th style='min-width: 242px;'>Proposta</th>";
tbArquivada.InnerHtml += " <th style='min-width: 65px;'>Prazo</th>";
tbArquivada.InnerHtml += " <th>Relatos</th>";
tbArquivada.InnerHtml += " <th>Visualizar</th>";
tbArquivada.InnerHtml += " </tr>";
while (rsListar.Read())
{
tbArquivada.InnerHtml += " <tr>";
tbArquivada.InnerHtml += " <td>" + rsListar["CDO_TAREFA"] + "</td>";
tbArquivada.InnerHtml += " <td>" + rsListar["CDO_DATA"] + "</td>";
tbArquivada.InnerHtml += " <td>" + rsListar["TOTAL_RELATOS"] + "</td>";
tbArquivada.InnerHtml += " <td><a href=\"/tarefa-arquivada/" + rsListar["CDO_ID"] + "\">Visualizar Proposta</a></td>";
//tbArquivada.InnerHtml += " <td>Visualizar Tarefa</td>";
tbArquivada.InnerHtml += " </tr>";
}
tbArquivada.InnerHtml += "</table>";
}
else
{
tbAtiva.InnerHtml += "</table>";
rsListar.NextResult();
if (rsListar.HasRows)
{
tbArquivada.InnerHtml += "<table class=\"tabela2\">";
tbArquivada.InnerHtml += " <tr>";
tbArquivada.InnerHtml += " <th style='min-width: 242px;'>Proposta</th>";
tbArquivada.InnerHtml += " <th style='min-width: 65px;'>Prazo</th>";
tbArquivada.InnerHtml += " <th>Relatos</th>";
tbArquivada.InnerHtml += " <th>Visualizar</th>";
tbArquivada.InnerHtml += " </tr>";
while (rsListar.Read())
{
tbArquivada.InnerHtml += " <tr>";
tbArquivada.InnerHtml += " <td>" + rsListar["CDO_TAREFA"] + "</td>";
tbArquivada.InnerHtml += " <td>" + rsListar["CDO_DATA"] + "</td>";
tbArquivada.InnerHtml += " <td>" + rsListar["TOTAL_RELATOS"] + "</td>";
tbArquivada.InnerHtml += " <td><a href=\"/tarefa-arquivada/" + rsListar["CDO_ID"] + "\">Visualizar Proposta</a></td>";
//tbArquivada.InnerHtml += " <td>Visualizar Tarefa</td>";
tbArquivada.InnerHtml += " </tr>";
}
tbArquivada.InnerHtml += "</table>";
}
}
}
示例5: ExecuteReaderInternal
private OleDbDataReader ExecuteReaderInternal(CommandBehavior behavior, string method)
{
OleDbDataReader dataReader = null;
OleDbException previous = null;
int num2 = 0;
try
{
object obj2;
int num;
this.ValidateConnectionAndTransaction(method);
if ((CommandBehavior.SingleRow & behavior) != CommandBehavior.Default)
{
behavior |= CommandBehavior.SingleResult;
}
switch (this.CommandType)
{
case ((System.Data.CommandType) 0):
case System.Data.CommandType.Text:
case System.Data.CommandType.StoredProcedure:
num = this.ExecuteCommand(behavior, out obj2);
break;
case System.Data.CommandType.TableDirect:
num = this.ExecuteTableDirect(behavior, out obj2);
break;
default:
throw ADP.InvalidCommandType(this.CommandType);
}
if (this._executeQuery)
{
try
{
dataReader = new OleDbDataReader(this._connection, this, 0, this.commandBehavior);
switch (num)
{
case 0:
dataReader.InitializeIMultipleResults(obj2);
dataReader.NextResult();
break;
case 1:
dataReader.InitializeIRowset(obj2, ChapterHandle.DB_NULL_HCHAPTER, this._recordsAffected);
dataReader.BuildMetaInfo();
dataReader.HasRowsRead();
break;
case 2:
dataReader.InitializeIRow(obj2, this._recordsAffected);
dataReader.BuildMetaInfo();
break;
case 3:
if (!this._isPrepared)
{
this.PrepareCommandText(2);
}
OleDbDataReader.GenerateSchemaTable(dataReader, this._icommandText, behavior);
break;
}
obj2 = null;
this._hasDataReader = true;
this._connection.AddWeakReference(dataReader, 2);
num2 = 1;
return dataReader;
}
finally
{
if (1 != num2)
{
this.canceling = true;
if (dataReader != null)
{
dataReader.Dispose();
dataReader = null;
}
}
}
}
try
{
if (num == 0)
{
UnsafeNativeMethods.IMultipleResults imultipleResults = (UnsafeNativeMethods.IMultipleResults) obj2;
previous = OleDbDataReader.NextResults(imultipleResults, this._connection, this, out this._recordsAffected);
}
}
finally
{
try
{
if (obj2 != null)
{
Marshal.ReleaseComObject(obj2);
obj2 = null;
}
this.CloseFromDataReader(this.ParameterBindings);
}
catch (Exception exception3)
{
//.........这里部分代码省略.........
示例6: DataReader2DataSet
public DataSet DataReader2DataSet ( OleDbDataReader reader )
{
DataSet dataSet = new DataSet ();
do
{
// Create new data table
DataTable schemaTable = reader.GetSchemaTable ();
DataTable dataTable = new DataTable ();
if ( schemaTable != null )
{
// A query returning records was executed
for ( int i = 0 ; i < schemaTable.Rows.Count ; i++ )
{
DataRow dataRow = schemaTable.Rows [ i ];
// Create a column name that is unique in the data table
string columnName = ( string ) dataRow [ "ColumnName" ];
// Add the column definition to the data table
DataColumn column = new DataColumn ( columnName , ( Type ) dataRow [ "DataType" ] );
dataTable.Columns.Add ( column );
}
dataSet.Tables.Add ( dataTable );
// Fill the data table we just created
while ( reader.Read () )
{
DataRow dataRow = dataTable.NewRow ();
for ( int i = 0 ; i < reader.FieldCount ; i++ )
dataRow [ i ] = reader.GetValue ( i );
dataTable.Rows.Add ( dataRow );
}
}
else
{
// No records were returned
DataColumn column = new DataColumn ( "RowsAffected" );
dataTable.Columns.Add ( column );
dataSet.Tables.Add ( dataTable );
DataRow dataRow = dataTable.NewRow ();
dataRow [ 0 ] = reader.RecordsAffected;
dataTable.Rows.Add ( dataRow );
}
}
while ( reader.NextResult () );
return dataSet;
}
示例7: AddFromReader
//.........这里部分代码省略.........
int lastColumn = reader.FieldCount - 1;
for (int i = 0; i < 2; ++i)
{
if (lastColumn == headerColumn || lastColumn == subheaderColumn)
{
lastColumn -= 1;
}
}
while (reader.Read())
{
HtmlGenericControl rowSetDiv = CreateDiv("RowSet");
resultSetDiv.Controls.Add(rowSetDiv);
bool headerAdded = false;
bool subheaderAdded = false;
if (headerColumn >= 0 && !reader.IsDBNull(headerColumn))
{
string header = reader.GetValue(headerColumn).ToString();
headerAdded = header != lastHeader;
if (headerAdded)
{
HtmlGenericControl headerDiv = CreateDiv("RowSetHeader", header);
rowSetDiv.Controls.Add(headerDiv);
lastHeader = header;
}
}
if (subheaderColumn >= 0 && !reader.IsDBNull(subheaderColumn))
{
string subheader = reader.GetValue(subheaderColumn).ToString();
subheaderAdded = subheader != lastSubHeader;
if (subheaderAdded)
{
if (headerAdded && addSpace)
{
AddSpace(rowSetDiv, "Space2");
}
HtmlGenericControl subheaderDiv = CreateDiv("RowSetSubheader", subheader);
rowSetDiv.Controls.Add(subheaderDiv);
lastSubHeader = subheader;
}
}
if (lastColumn < 0)
{
if (addSpace)
{
AddSpace(rowSetDiv, "Space2");
}
}
else
{
if ((headerAdded || subheaderAdded) && addSpace)
{
AddSpace(rowSetDiv, "Space2");
}
for (int i = 0; i < reader.FieldCount; ++i)
{
if (i != headerColumn && i != subheaderColumn)
{
HtmlGenericControl valueSetDiv = CreateDiv("ValueSet");
rowSetDiv.Controls.Add(valueSetDiv);
HtmlGenericControl labelDiv = CreateDiv("Label", reader.GetName(i));
valueSetDiv.Controls.Add(labelDiv);
if (addSpace)
{
HtmlGenericControl separatorDiv = CreateDiv("Separator", "");
valueSetDiv.Controls.Add(separatorDiv);
}
HtmlGenericControl valueDiv = CreateValueDiv(!reader.IsDBNull(i) ? reader.GetValue(i) : null);
valueSetDiv.Controls.Add(valueDiv);
if (i < lastColumn && addSpace)
{
AddSpace(rowSetDiv, "Space1");
}
}
}
if (addSpace)
{
AddSpace(rowSetDiv, "Space4");
}
}
}
}
}
while (reader.NextResult());
}
示例8: ExecuteReader
public new OleDbDataReader ExecuteReader (CommandBehavior behavior)
{
ArrayList results = new ArrayList ();
IntPtr rs_list;
GdaList glist_node;
if (connection.State != ConnectionState.Open)
throw new InvalidOperationException ("State != Open");
this.behavior = behavior;
IntPtr gdaConnection = connection.GdaConnection;
IntPtr gdaParameterList = parameters.GdaParameterList;
/* execute the command */
SetupGdaCommand ();
rs_list = libgda.gda_connection_execute_command (
gdaConnection,
gdaCommand,
gdaParameterList);
if (rs_list != IntPtr.Zero) {
glist_node = (GdaList) Marshal.PtrToStructure (rs_list, typeof (GdaList));
while (glist_node != null) {
results.Add (glist_node.data);
if (glist_node.next == IntPtr.Zero)
break;
glist_node = (GdaList) Marshal.PtrToStructure (glist_node.next,
typeof (GdaList));
}
dataReader = new OleDbDataReader (this, results);
dataReader.NextResult ();
}
return dataReader;
}