Thread: Wrox CMS in C#
View Single Post
  #6 (permalink)  
Old February 23rd, 2007, 10:20 AM
.Netster .Netster is offline
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks Imar and Doug for your fast responses!! makes the book worth ten times its value and why I personally favour wrox over its competitors!!

I have added the missing events on the aspx pages from the code behind files. Does VB.Net not require the event handlers applied to the controls in the aspx files?

I am currently having trouble with getting the main content for the articles thus preventing me viewing or editing it.

When converting the code from VB I altered the SQL data reader "myReader" and I think this maybe causing the problem:

Code:
    public static Content GetItem(int id)
    {
        Content theContentItem = null;
        string cnString = ConfigurationManager.ConnectionStrings["Cms"].ConnectionString;
        SqlConnection myConnection = new SqlConnection(cnString);
        {
            SqlCommand myCommand = new SqlCommand("sprocContentSelectSingleItem", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters.AddWithValue("@id", id);
            myConnection.Open();
            SqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

            {
                if (myReader.Read())
                {
                    theContentItem = new Content(myReader.GetInt32(myReader.GetOrdinal("Id")));
                    theContentItem.Title = myReader.GetString(myReader.GetOrdinal("Title"));
                    theContentItem.IntroText = myReader.GetString(myReader.GetOrdinal("IntroText"));
                    theContentItem.BodyText = myReader.GetString(myReader.GetOrdinal("BodyText"));
                    theContentItem.ContentTypeId = myReader.GetInt32(myReader.GetOrdinal("ContentTypeId"));
                    theContentItem.CategoryId = myReader.GetInt32(myReader.GetOrdinal("CategoryId"));
                    theContentItem.Visible = myReader.GetBoolean(myReader.GetOrdinal("Visible"));
                }
                myReader.Close();
            }
        }
        return theContentItem;
    }


latest version can be downloaded from http://www.gkadata.com/files/CmsC.rar

Any help would be great!!! Thanks again.