468,133 Members | 1,261 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

Asp.net(vb) : SQL error when inserting records

ak1dnar
1,584 Expert 1GB
Hi,
I am getting some sql errors when trying to insert a record to mysql table using asp.net application.

Let me explain the scenario for your reference.

This asp.net web form is executing perfectly when i am trying it in my localhost.

The error is getting when I tried it with my hosting server.
Expand|Select|Wrap|Line Numbers
  1. System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Dr_no', table 'myDB.username.tablename'; column does not allow nulls. INSERT fails. 
  2.  
This Dr_no its the primary key of the table. I am not entering data using my code. yeah its really a Identity column.
But why is that error about NULL values?

one more thing I should say to you guys,
Actually there are nearly 2500 records in the table currently.
Will it be the problem, I mean time out issues or some thing.

because This error also getting (not always) in my query analyser when I am executing queries against remote host.

Query Analyser:

Expand|Select|Wrap|Line Numbers
  1. [Microsoft][ODBC SQL Server Driver]TDS buffer length too large
  2.  

Here this is the complete error:

Asp.net page

Expand|Select|Wrap|Line Numbers
  1. System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Dr_no', table 'myDB.username.tablename'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at myproject.registration.Page_Load(Object sender, EventArgs e) 
  2.  
Jul 26 '07 #1
2 1468
ak1dnar
1,584 Expert 1GB
Hi,

The problem was with the table structure not ASP.net.

In the local server there is a Identity column for the table where I am inserting data. but on the hosting server the identity column fileds is missing. so that Its asking a value for the column.

I've copied these local table to the hosting server MsSQL server using import and export data wizard.

but the identity column is not availabe on the hosting server side.
but still its there @ my Local server. same copy.

what is the reason for this?

thanks!
Jul 30 '07 #2
ak1dnar
1,584 Expert 1GB
And one more thing, if you guys don't have a Idea about this,
Please Move this to MSSQL server forum.
Thanks!
Jul 30 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by ASP .NET Newbie | last post: by
5 posts views Thread by Erich Kolb | last post: by
9 posts views Thread by James | last post: by
3 posts views Thread by Yannick | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.