Results 1 to 6 of 6

Thread: ExecuteReader: CommandText property has not been initialized

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    266

    ExecuteReader: CommandText property has not been initialized

    I'm facing this problem while saving some records plz help me I dont know y this occurs and what should i do to avoid this.

    I'm using c# 2005 and sql server 2005

    Thanx in advance

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: ExecuteReader: CommandText property has not been initialized

    Well, I don't see how you could be using a reader to save data, but beyond that, I think we'll need to see some code in order to figure it out.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: ExecuteReader: CommandText property has not been initialized

    Once again, I feel compelled to point out that contrary to popular belief, we are not mind readers here. I don't know how this rumor got started, but it's time it ended.

    Perhaps if you show us the code in question we might be able to help. Odds are you haven't set the InsertCommand text to the appropriate SQL. But like I said, we're not mind readers.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    266

    Re: ExecuteReader: CommandText property has not been initialized

    m so sorry for not writing code

    m jus usin as
    VB Code:
    1. DbAdapter.SelectCommand.CommandText = strSQL;
    2.                 SqlCommandBuilder DbCommandBuilder = new SqlCommandBuilder(DbAdapter);
    3.                 DbCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
    4.                 return DbAdapter.Update(dSet, tblName);

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ExecuteReader: CommandText property has not been initialized

    Would also help if you told us what you mean by "this problem"

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: ExecuteReader: CommandText property has not been initialized

    Quote Originally Posted by mendhak
    Would also help if you told us what you mean by "this problem"
    You mean the one that's in the thread title?


    As I stated, you're not setting the InsertCommand statement, so it doesn't know how to insert new records.
    You're instantiating the CommandBuilder, but then never actually use it either.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width