View Single Post
  #1 (permalink)  
Old March 9th, 2009, 01:56 PM
iceman90289 iceman90289 is offline
Friend of Wrox
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default Making the Page_Load() work

okay so my page load for my profile page is supposedly planned as:

1) (on the first time run only) Open a connection to my database and add a table to it.

2) Comment out table creation code

3) add code to check the table for new messages for the signed in user

4) Get the number of these messages and display them in a link saying "{0} new messages"

thats it so far... im stuck on step one:

here is my code, its the first thing in Page_Load()

// One time use: create database table:
string con = WebConfigurationManager.ConnectionStrings["myconnection"].ConnectionString;
SqlConnection sqlcon = newSqlConnection(con);
SqlCommand cmd = newSqlCommand("CREATE TABLE Messages(Id Int Identity(1,1), Sender NVarChar(11), Recievers NVarChar, MessageBody NVarChar(1500), MessageSubject NVarChar(25), status Int");
cmd.Connection = sqlcon;
using (sqlcon)
now when i run this code... it complains that i dont have permission to do this.