473,499 Members | 1,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

ak1dnar
1,584 Recognized Expert Top Contributor
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 1698
ak1dnar
1,584 Recognized Expert Top Contributor
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 Recognized Expert Top Contributor
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

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

Similar topics

3
4930
by: Paul M. | last post by:
Hi, I am trying to populate 3 paramters in an asp .net (vb) page redirect, the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings!...
9
3792
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
5
2104
by: Erich Kolb | last post by:
R&B Solutions, a leader in medical receivables management, is currently recruiting for several .Net developers who have in depth experience with ASP.net, VB.net, XML, XSLT, Web Services, and SQL...
9
1479
by: James | last post by:
So far, is basically dispise ADO.NET & VB.NET. Here's why: Too many confusing ways to do simple things. Here are two examples that maybe someone can help me with: (1) I have TextBox controls...
3
2241
by: Yannick | last post by:
Hi, I try to execute request on a ms-access database but I have a problem with date. the "myDate" field's format is "date/time" my request is: SELECT myCode, myStuff, myDATE FROM myTable ...
4
5115
by: Henry | last post by:
Is there a way in ASP.NET/VB.NET to get the current form name. I'd like to store the name in a session variable for use on an Error page and use it to return to the page that had the error. Tks...
1
2134
by: ourspt | last post by:
Hi, We are working on an ASP.NET (VB.NET) application and we have a problem opening a word document from our application. When we try to open the word document, we do not get any error...
8
1527
by: Jimbo | last post by:
Hello I am currently designing an internal ordering system for IT equipment. I am designing it in ASP.NET (vb) using Visual Studio 2003 and using Microsoft SQL Server I have got the system...
0
1036
by: blackburnj55 | last post by:
Hi I am inserting some records into my access database using asp.net vb script. The problem is that "Username" is set to "Not Null" in my database and so i get the following message returned. ...
1
3064
by: Pipo Dyer | last post by:
Hello Everybody, I am Using @@IDENTITY from MS Access (YES-It is possible) using SqlDataSource -NO STORE PROC- in ASP.NET {VB CODE} to retrieve the ID of a inserted record. Please keep in mind I...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7012
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.