473,804 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access DB error message when using ASP.NET 2.0

Hi

I was wondering if anyone could help me with this problem. I've been using
VWD and my webhost ( a shared hosting package) have told me that the MSQL
express files wont work on thier server so I've tried switching to Access
and I cant add or delete new records either locally or on thier server.

I keep getting this error message.

"You tried to assign the Null value to a variable that is not a Variant data
type"

I've had a look at folder permissions and field data types.

Any help would be welcome.

Regards
--
Richard Finnigan
Work Website http://www.ict-action.com
Homepage http://www.richardsthings.co.uk
Hobby Webpage http://www.closeimage.co.uk
Jul 30 '06 #1
3 2435
Hi, Richard.

Access data types include Boolean, Integer, Long,
Currency, Single, Double, Date, String, and Variant.

The Variant data type, in Access, is the default.

That error is caused by what the error message says:
only Variant data type variables can be assigned a Null value.

There's at least a couple of possible causes for that error.

1.
A control on a form that has had nothing entered has the value Null,
so you're submitting a null string value (which is not of the Variant type).

An easy way to fix that is to use the text box's BeforeUpdate event to check for data.

Private Sub txtName_BeforeU pdate(Cancel As Integer)

If IsNull(Me.txtNa me) Then
' display an alert telling the user that some data is needed for the field
Cancel = True
End If
End Sub

However, it's more probable that your problem is :

2.
When you insert a row into a table that has an autonumber field,
you don't need to include that field name in your insert statement.

See : http://forums.asp.net/thread/1239942.aspx
for a pointer on how to fix that.

This link also has a clear example of what you need to do:
http://forums.hostmysite.com/post-8420.html

Please post back and tell us whether one of those two possible solutions fixed your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Richard Finnigan" <di*******@btop enworld.comwrot e in message
news:yb******** ************@bt .com...
Hi

I was wondering if anyone could help me with this problem. I've been using VWD and my webhost ( a
shared hosting package) have told me that the MSQL express files wont work on thier server so I've
tried switching to Access and I cant add or delete new records either locally or on thier server.

I keep getting this error message.

"You tried to assign the Null value to a variable that is not a Variant data type"

I've had a look at folder permissions and field data types.

Any help would be welcome.

Regards
--
Richard Finnigan
Work Website http://www.ict-action.com
Homepage http://www.richardsthings.co.uk
Hobby Webpage http://www.closeimage.co.uk


Jul 30 '06 #2

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:Or******** ******@TK2MSFTN GP06.phx.gbl...
Hi, Richard.

Access data types include Boolean, Integer, Long,
Currency, Single, Double, Date, String, and Variant.

The Variant data type, in Access, is the default.

That error is caused by what the error message says:
only Variant data type variables can be assigned a Null value.

There's at least a couple of possible causes for that error.

1.
A control on a form that has had nothing entered has the value Null,
so you're submitting a null string value (which is not of the Variant
type).

An easy way to fix that is to use the text box's BeforeUpdate event to
check for data.

Private Sub txtName_BeforeU pdate(Cancel As Integer)

If IsNull(Me.txtNa me) Then
' display an alert telling the user that some data is needed for the
field
Cancel = True
End If
End Sub

However, it's more probable that your problem is :

2.
When you insert a row into a table that has an autonumber field,
you don't need to include that field name in your insert statement.

See : http://forums.asp.net/thread/1239942.aspx
for a pointer on how to fix that.

This link also has a clear example of what you need to do:
http://forums.hostmysite.com/post-8420.html

Please post back and tell us whether one of those two possible solutions
fixed your problem.

Hi Julian

Thanks for your help with this problem, It was the second issue and
removing references to the ID field fixed it.

I've now hit the folder permissions issue on the remote website :(

Hayho.

Richard Finnigan
Jul 31 '06 #3
re:
Thanks for your help with this problem,
You're quite welcome, Richard.

re:
It was the second issue and removing references to the ID field fixed it.
It's good to know that you're up and running again!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Richard Finnigan" <di*******@btop enworld.comwrot e in message
news:o8******** *************** *******@bt.com. ..
>
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:Or******** ******@TK2MSFTN GP06.phx.gbl...
>Hi, Richard.

Access data types include Boolean, Integer, Long,
Currency, Single, Double, Date, String, and Variant.

The Variant data type, in Access, is the default.

That error is caused by what the error message says:
only Variant data type variables can be assigned a Null value.

There's at least a couple of possible causes for that error.

1.
A control on a form that has had nothing entered has the value Null,
so you're submitting a null string value (which is not of the Variant type).

An easy way to fix that is to use the text box's BeforeUpdate event to check for data.

Private Sub txtName_BeforeU pdate(Cancel As Integer)

If IsNull(Me.txtNa me) Then
' display an alert telling the user that some data is needed for the field
Cancel = True
End If
End Sub

However, it's more probable that your problem is :

2.
When you insert a row into a table that has an autonumber field,
you don't need to include that field name in your insert statement.

See : http://forums.asp.net/thread/1239942.aspx
for a pointer on how to fix that.

This link also has a clear example of what you need to do:
http://forums.hostmysite.com/post-8420.html

Please post back and tell us whether one of those two possible solutions fixed your problem.

Hi Julian

Thanks for your help with this problem, It was the second issue and removing references to the ID
field fixed it.

I've now hit the folder permissions issue on the remote website :(

Hayho.

Richard Finnigan

Jul 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8059
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan records and validate added data. My question is..
6
4765
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
49
14365
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
7
8876
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
11
6607
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
29
15554
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ---Start of test.aspx---- <%@ Page language="C#" AutoEventWireup="false" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD>
10
8721
by: Shawn | last post by:
JIT Debugging failed with the following error: Access is denied. JIT Debugging was initiated by the following account 'PLISKEN\ASPNET' I get this messag in a dialog window when I try to open an asp.net page. If I press OK then I get a page with this message: Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser...
8
9766
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
9
3848
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
2
19499
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9715
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10097
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6867
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
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 we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.