Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
Problem with dataset crashing my app
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="David, post: 2878886"] Hi, using C# asp.net 1.1 I am having a problem. If I use the code below, but have null passed as the PostingGuid, then by the time I get to fill the dataset, I have "an object is not set to an instance of an object". This then totally knocks out any connection to my database for the rest of my application until I terminate the aspnet process. Basically, if I have a null PageGuid, then the result from my query will be empty (not sure if it is null). If I wrap an if statement around the whole thing (below DS and above return DS) checking for PostingGuid null, I don't have a problem, but I feel that this is a hack rather than a fix. Also, there could be a case where PostingGuid is not null but the return from the database is still empty (or null) public DataSet PagePropertiesRead(string PostingGuid) { DataSet DS = new DataSet(); DataAccessLayer.ProviderFactory DL = new DataAccessLayer.ProviderFactory(DB); string sql = string.Empty; try { conn = DL.CreateConnection(ConnectionString); conn.Open(); sql = "select * from Page where PageGuid = ? limit 0, 1"; // NOTE: This is MySQL cmd = DL.CreateCommand(sql, conn); cmd = AddParameter(DL, cmd, "@PageGuid", DbType.String, PostingGuid); DA = DL.CreateDataAdapter(); DA.SelectCommand = cmd; DA.Fill(DS); <-- BREAKS HERE } catch (Exception ex) { string Text = ex.Message; } finally { conn.Close(); } return DS; } -- Best regards, Dave Colliver. [URL]http://www.AshfieldFOCUS.com[/URL] ~~ [URL]http://www.FOCUSPortals.com[/URL] - Local franchises available [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
Problem with dataset crashing my app
Top