1
vote
3answers
391 views

Cannot insert the value NULL into column 'UserId'

I am getting this exception and can not figure out why: Cannot insert the value NULL into column 'UserId' This is my code: <asp:TextBox ID="FirstNameBox" runat="server" /> <br /> <br ...
1
vote
1answer
67 views

User.Identity.Name to SQL parameter

I have this code: protected void Page_Load(object sender, EventArgs e) { SqlDataSource4.SelectParameters["zadavatel"].DefaultValue = this.Page.User.Identity.Name; } Markup: ...
1
vote
0answers
1k views

Insert database row via ASP.net 4.5 GridView on-board functionality?

I would like to insert a database entry by using standard functions of my GridView and SqlDataSource. Has there been any update on this topic since the dirty workarounds some versions ago (e.g. see ...
0
votes
2answers
3k views

Setting the value of insert parameter of SqlDataSource in codebehind

I have this SqlDataSource in my form: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ...
0
votes
2answers
2k views

ASP.net Insert blank rows into Gridview

I have a gridview that is bound to a sqldatasource. The Gridview only has a pagesize of 10 and I would like each page to have 10 rows. Therefore if only 5 data rows exist then I would like to add an ...
0
votes
1answer
2k views

sqldatasource insert return identity value

Im using SqlDataSource sds = new SqlDataSource(); in code behind and inserting using sds.Insert(); Please tell me how to get inserted record primary key value? Please note im not using stored ...
0
votes
1answer
594 views

SQLDataSource Insert method not working in CodeBehind .NET C#

I'm writing an ASP web project for a degree module and I have to insert some login details into a login table. It was working fine whilst I had it running as a script in the .aspx file, but I needed ...
-2
votes
1answer
36 views

When I try to insert data from textboxes to SqlDataSource, it gives me error “Object reference not set to an instance of an object”

protected void btnInsert_Click(object sender, EventArgs e) { string custName = ddlCustomerName.SelectedValue; string listing = ddlListing.SelectedValue; ...