Click here to Skip to main content
16,005,316 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: chekbox in javascript Pin
N a r e s h P a t e l13-Aug-07 18:53
N a r e s h P a t e l13-Aug-07 18:53 
QuestionUpload, download and display images from web server Pin
J Liang13-Aug-07 17:54
J Liang13-Aug-07 17:54 
AnswerRe: Upload, download and display images from web server Pin
N a r e s h P a t e l13-Aug-07 19:18
N a r e s h P a t e l13-Aug-07 19:18 
GeneralRe: Upload, download and display images from web server Pin
J Liang14-Aug-07 14:57
J Liang14-Aug-07 14:57 
QuestionDynamic number of controls Pin
sandrider13-Aug-07 17:54
sandrider13-Aug-07 17:54 
AnswerRe: Dynamic number of controls Pin
shivamray13-Aug-07 18:44
shivamray13-Aug-07 18:44 
GeneralRe: Dynamic number of controls Pin
sandrider13-Aug-07 19:20
sandrider13-Aug-07 19:20 
Questionproblem with SubmitSqlDataSource.InsertParameters Pin
hurrem13-Aug-07 17:50
hurrem13-Aug-07 17:50 
Hi,
I can't understand what is wrong here, can somebody look it up please.
I get and exception: Cannot insert the value NULL into column 'NID', table 'C:\...'; column does not allow nulls. INSERT fails.
The statement has been terminated.

but during the debugging it shows that it gets the value.

Here is my code:

<asp:SqlDataSource ID="SubmitSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:NConnectionString %>"<br />
        InsertCommand="INSERT INTO NTable(NID, Headline, Category, Tags, Username, Date, Rating, CountRating, Enabled) VALUES (@newsID, @headline, @category, @tags, @username, @date, NULL, 0, @enabled)"<br />
        OnInserting="SubmitSqlDataSource_Inserting" ><br />
        <InsertParameters><br />
            <asp:Parameter Name="newsID" /><br />
            <asp:Parameter Name="headline" /><br />
            <asp:Parameter Name="category" /><br />
            <asp:Parameter Name="tags" /><br />
            <asp:Parameter Name="username" /><br />
            <asp:Parameter Name="date" /><br />
            <asp:Parameter Name="enabled" /><br />
        </InsertParameters><br />
    </asp:SqlDataSource>


Here is my C# code:

protected void SubmitSqlDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)<br />
    {<br />
        newsID = System.Guid.NewGuid();<br />
        TextBox HeadlineTextBox = (TextBox)SubmitFormView.FindControl("HeadlineTextBox");<br />
        DropDownList CategoriesDDL = (DropDownList)SubmitFormView.FindControl("CategoriesDDL");<br />
        TextBox TagsTextBox=(TextBox)SubmitFormView.FindControl("TagsTextBox");<br />
        CheckBox EnabledCheckBox = (CheckBox)SubmitFormView.FindControl("EnabledCheckBox");<br />
        SubmitSqlDataSource.InsertParameters["newsID"].DefaultValue = Convert.ToString(newsID);<br />
        SubmitSqlDataSource.InsertParameters["headline"].DefaultValue = HeadlineTextBox.Text;<br />
        SubmitSqlDataSource.InsertParameters["category"].DefaultValue = CategoriesDDL.SelectedValue;<br />
        SubmitSqlDataSource.InsertParameters["tags"].DefaultValue = TagsTextBox.Text;<br />
        SubmitSqlDataSource.InsertParameters["username"].DefaultValue = Membership.GetUser().UserName.ToString();<br />
        SubmitSqlDataSource.InsertParameters["date"].DefaultValue=DateTime.Now.ToString();<br />
        SubmitSqlDataSource.InsertParameters["enabled"].DefaultValue = EnabledCheckBox.Checked.ToString();<br />
}


Thx
Questionplease help Pin
seemamltn13-Aug-07 17:44
seemamltn13-Aug-07 17:44 
AnswerRe: please help Pin
Michael Sync13-Aug-07 20:03
Michael Sync13-Aug-07 20:03 
AnswerRe: please help Pin
neerubee13-Aug-07 20:46
neerubee13-Aug-07 20:46 
AnswerBAD USER! Pin
leckey14-Aug-07 4:59
leckey14-Aug-07 4:59 
Questionsvg mapping using asp.net??? Pin
mmm!@#13-Aug-07 17:16
mmm!@#13-Aug-07 17:16 
Questionhow to access the checkbox control in nested gridview Pin
SharonRao13-Aug-07 15:03
SharonRao13-Aug-07 15:03 
QuestionImages Pin
seemamltn13-Aug-07 14:17
seemamltn13-Aug-07 14:17 
QuestionUnable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Nadia Monalisa13-Aug-07 11:31
Nadia Monalisa13-Aug-07 11:31 
AnswerRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Michael Sync13-Aug-07 15:40
Michael Sync13-Aug-07 15:40 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Nadia Monalisa13-Aug-07 17:09
Nadia Monalisa13-Aug-07 17:09 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Michael Sync13-Aug-07 17:44
Michael Sync13-Aug-07 17:44 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Nadia Monalisa13-Aug-07 23:51
Nadia Monalisa13-Aug-07 23:51 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Member 766318817-Aug-11 8:00
Member 766318817-Aug-11 8:00 
QuestionDatagrid help Pin
Ridge Howison13-Aug-07 10:48
Ridge Howison13-Aug-07 10:48 
AnswerRe: Datagrid help Pin
Fred_Smith13-Aug-07 12:39
Fred_Smith13-Aug-07 12:39 
QuestionAccess Asp.net control from client side javascript Pin
Ali Rafiee13-Aug-07 9:28
Ali Rafiee13-Aug-07 9:28 
QuestionRadioButtonList and Hover Balloon Pin
janetb9913-Aug-07 9:22
janetb9913-Aug-07 9:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.