TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhimanyu K Vatsa
NA
40.4k
21.4m
Cannot insert the value NULL into column 'name'......
Jun 12 2010 1:29 AM
I am facing the error:
{"Cannot insert the value NULL into column 'name', table 'C:\\DOCUMENTS AND SETTINGS\\ADMINISTRATOR\\DESKTOP\\ARTICLE 17\\SIMPLE LOGIN PROJECT IN ASP.NET\\APP_DATA\\MYDB.MDF.dbo.myTb'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated."}
I have following MSSQL server database
*************************************
id int Unchecked
name varchar(100) Unchecked
username varchar(100) Unchecked
password varchar(100) Unchecked
emailid varchar(100) Unchecked
I am following code in Default.aspx page
*******************************************
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:myDbConnectionString1 %>"
InsertCommand="INSERT INTO myTb(name, username, password, emailid) VALUES (@name, @username, @password, @emailid)" SelectCommand="SELECT myTb.* FROM myTb">
<InsertParameters>
<asp:FormParameter Name="name" FormField="name" />
<asp:FormParameter Name="username" FormField="username" />
<asp:FormParameter Name="password" FormField="password" />
<asp:FormParameter Name="emailid" FormField="emailid" />
</InsertParameters>
</asp:SqlDataSource>
I have following code in default.aspx.cs page
***************************************
protected void create_Click(object sender, EventArgs e)
{
SqlDataSource1.Insert();
}
Then, why I am facing the error like 'name' can not be null. Is something missing there?
Reply
Answers (
1
)
data in GridView
Display Datagridview Data