ado.net beginners question

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: ado.net beginners question

    You'll get that error if the sql statement is empty/blank (in your case,
    strCallLog). What is the value of strCallLog when you get that error? You
    may want to add in a test for when strCallLog is equal to String.Empty.

    --
    James J. Foster, DotNetCoders
    [url]http://www.dotnetcoders.com[/url]


    "Mike P" <mrp@telcoelectronics.co.uk> wrote in message
    news:OPS6630VDHA.2168@TK2MSFTNGP09.phx.gbl...
    > Can anybody tell me what is wrong with this code? The error I get is
    > 'CommandText property has not been initialized'.
    >
    > void BindData(string strCallLog)
    > {
    > SqlConnection objConnection = new
    > SqlConnection(ConfigurationSettings.AppSettings["strConnectTransitTest"]
    > );
    > SqlDataAdapter objDataAdapter = new SqlDataAdapter(strCallLog,
    > objConnection);
    >
    > DataTable objDataTable = new DataTable();
    > objDataAdapter.Fill(objDataTable);
    >
    > Session["LogData"] = objDataTable;
    > dgLog.DataSource = objDataTable;
    > dgLog.DataBind();
    > }
    >
    >
    > Cheers,
    >
    > Mike
    >
    >
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    James J. Foster Guest

  2. Similar Questions and Discussions

    1. Beginners question on LEFT JOINS
      Yeah, I know this was KINDA covered in databases, but could somebody give me a refresher of what a left join is in, say, terms of tables FOO and...
    2. 3d beginners question
      Hi, what 3d modellers program would you advise me to use with director ON a mac? OR: I already know blender a bit. Is there a way that a...
    3. Beginners question : controlling an child
      I have an 'beginners" question..... I use the following line tot rotate my 3dmax model member("Filename").model("car").rotate(0,0,1,#self) ...
    4. Beginners question
      I am a complete novice at Flash - but thought it a good thing to learn. I am trying to make text move from left to right. I have done this by...
    5. Beginners question about tables
      Hi, When using tables is there a way of fixing cell width and height, I was told there was a 'locking' option. Another related problem is that...
  3. #2

    Default Re: ado.net beginners question

    Thanks for your help. I've found that I was losing the string value on
    postback, so I changed the string to a Session variable and it seems to
    work fine.


    Cheers,

    Mike



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Mike P Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139