I have been collecting data from ms.access database into a class object - '_Get and put in data from database Fingerprint(RAS) into CPresensiFingerprint
-
Public Function GetdbFingerprint() As CPresensiFingerprint
-
Dim presensiFinger As New CPresensiFingerprint
-
Dim SQLSelectdbRAS As String
-
Dim rsFinger As Recordset
-
Dim dateNow_ As Date
-
-
dateNow_ = um_TgldanJamSkrg()
-
-
SQLSelectdbRAS = "SELECT a.DN, b.DIN, c.PIN, c.UserName, b.Clock, d.ItemName " & _
-
"FROM ((ras_Device a INNER JOIN ras_AttRecord b ON a.DN=b.DN) " & _
-
"LEFT JOIN ras_Users c ON b.DIN=c.DIN) " & _
-
"LEFT JOIN ras_AttTypeItem d ON b.AttTypeId=d.ItemId " & _
-
"WHERE b.DIN=c.DIN AND Format(b.Clock, 'mm/dd/yyyy')=#" & _
-
Format(dateNow_, "mm/dd/yyyy") & "#"
-
Debug.Print SQLSelectdbRAS
-
Set rsFinger = da_GetRs(SQLSelectdbRAS)
-
-
If Not rsFinger.EOF Then
-
presensiFinger.device = rsFinger.Fields("DN").Value
-
presensiFinger.idFinger = rsFinger.Fields("DIN").Value
-
presensiFinger.Nik = rsFinger.Fields("PIN").Value
-
presensiFinger.Name = rsFinger.Fields("UserName").Value
-
presensiFinger.DateNow = rsFinger.Fields("Clock").Value
-
presensiFinger.timeIn = rsFinger.Fields("Clock").Value
-
presensiFinger.AbsentType = rsFinger.Fields("ItemName").Value
-
End If
-
-
rsFinger.Close
-
Set rsFinger = Nothing
-
-
Set GetdbFingerprint = presensiFinger
-
-
End Function
-
-
With name from class module
-
CPresensiFingerprint
-
-
Public PVID As Long
-
Public device As Integer
-
Public idFinger As Integer
-
Public DateNow As Date
-
Public Nik As String
-
Public Name As String
-
Public timeIn As Date
-
Public timeOut As Date
-
Public AbsentType As String
-
Public OTHoursNotApproved As Integer
-
-
I want input the created data from ms.access into sql server 2005 database with class module object
-
-
'_Input data from CPresensiFingerprint into dbSIKawan (table finger_data_karyawan)
-
Public Function SavePresensiIn(ByVal presensiSlot As CPresensiFingerprint) As Long
-
Dim rsSIKawan As Recordset
-
Dim SQLInsertdbSIKawan As String
-
Dim SQLSelectdbSIKawan As String
-
Dim PVID As Long
-
-
Set presensiSlot = New CPresensiFingerprint
-
-
SQLInsertdbSIKawan = "INSERT INTO finger_data_karyawan(Device, idFinger, NIKKary, Namakary," & _
-
" TglHadir, TimeIn, TipeAbsen)" & _
-
" VALUES('" & presensiSlot.device & "', '" & presensiSlot.idFinger & "', '" & _
-
presensiSlot.Nik & "', '" & presensiSlot.Name & "', '" & _
-
Format(DateValue(presensiSlot.DateNow), "mm/dd/yyyy") & "', '" & _
-
Format(presensiSlot.timeIn, "mm/dd/yyyy hh:nn:ss") & "', '" & _
-
presensiSlot.AbsentType & "')"
-
Call ExeQUERY(SQLInsertdbSIKawan)
-
-
SQLSelectdbSIKawan = "SELECT TOP 1 a.idNo FROM finger_data_karyawan a WHERE a.NIKKary='" & _
-
presensiSlot.Nik & "' AND a.TglHadir='" & _
-
Format(DateValue(presensiSlot.DateNow), "mm/dd/yyyy") & "' ORDER BY a.idNo DESC"
-
Set rsSIKawan = da_GetRecord(SQLSelectdbSIKawan)
-
PVID = rsSIKawan.Fields("idNo").Value
-
-
rsSIKawan.Close
-
Set rsSIKawan = Nothing
-
-
SavePresensiIn = PVID
-
-
End Function
-
-
I want the data that has collected in sql server 2005 from class module with auto number,
-
-
Private Sub Form_Load()
-
Dim presensiSlot As CPresensiFingerprint
-
-
Call SavePresensiIn(presensiSlot)
-
-
End Sub
but when i running the application. i get error message.
'Cannot insert the value NULL into column 'idNo', table 'dbSIKawan.dbo. finger_data_kar yawan'; column does not allow nulls. INSERT fails'
I want the all data insert into sql server database with auto number, so if I want to add other data, the old data is not affected by new data.
Can anyone help me?
Regards,
Octo
1 2689 jimatqsi 1,277
Recognized Expert Top Contributor
An auto-number can never be NULL. I don't see anything in your code that is setting idNo to anything, so if this is all the relevant code I am wondering if the column is defined correctly in the table.
You don't tell very much where this error is occuring, only "when running the application", so I think maybe the error is happening elsewhere, where some code is saying "idNo=" NULL something that is null, or else the column is not really defined to be an auto-number.
Jim
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Chris Gilbert |
last post by:
I'm quite stuck with this:
I have an import table called ReferenceMatchingImport which contains
data that has been sucked from a data submission. The contents of
this table have to be imported into another table ExternalReference
which has various foreign keys.
This is simple but one of these keys says that the value in
ExternalReference.CompanyRef must be in the CompanyReference table.
Of course if this is an initial import then it...
|
by: Ken |
last post by:
Need help on the Auto Number or Identity Seed on the Oracle Database
I got an Access database that need to be converted to Oracle 9i.
Somehow the Trigger we created to simulate the "AUTO NUMBER" on Access
could not create the sequence number as soon as the value has been
inserted. The sequence number can only be created after we go to the
second line. Please see the trigger below.
Is there anyway we could create a trigger that could...
|
by: Shahar |
last post by:
Hi
I need to get a field name 'ID'(that is an auto-number field) right
after I add a new row to table, it's work like that:
myCommand.ExecuteNonQuery();
myCommand.CommandText = "SELECT @@Identity"; // the auto-number fiels
int iId = (int)myCommand.ExecuteScalar();
|
by: Fabio Negri Cicotti [MCP] |
last post by:
Hi All.
I'm trying to insert data into 2 tables (parent-child) using the ADO.NET's
SetParentRow method. The parent table has an identity column as primary key.
When I execute the code below I get the following message: "Cannot insert
the value NULL into column 'hdtID', table
'myinstance.mydb.Hotel_Details_Lang'; column does not allow nulls. INSERT
fails." Any idea?
PS: To create the DataAdapters, I'm using SqlCommandBuilder.
|
by: Phil Latio |
last post by:
I have 2 virtually identical tables and wish to move data between them.
Basically one table is called "live_table" and the other is named
"suspended_table" and the only difference is that the primary key in the
"suspended_table" is an auto incremented integer where as "live_table"
primary key is just a standard integer.
Here's the life-cycle:
1. Record gets entered into "suspended_table"
2. Record checked and then inserted into...
| |
by: diane |
last post by:
Just trying to upsize using VFP 9 with SQL 2005 using VFP remote
views. One in particular keeps coming up and saying Cannot insert the
value NULL into column, when I really don't think I am inserting a
NULL value. Oddly sometimes it works but I don't know why. Can anyone
suggest anything else I can try? Perhaps this is the wrong group I'm
posting to - it was just the one that came up with other errors giving
the same message, but none of...
|
by: karenkksh |
last post by:
Hi,
The user_id is set as primary key.
"Cannot insert the value NULL into column 'user_id', table 'C:\DOCUMENTS AND SETTINGS\KAREN\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\WEBSITE1\APP_DATA\DB.MDF.dbo.users'; column does not allow nulls. INSERT fails.
The statement has been terminated." after debugging it.
protected void btnAdd_Click(object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand MyCommand;
|
by: billa856 |
last post by:
Hi,
I am trying to insert Null value in column(ShipDate) in my table.That column(ShipDate)'s type id date/time and format is short date.
I am using "" to insert Null in that column(ShipDate) but it shows warning that
customer can't append all the records in the append query.
Customer set 1 field(s) to Null due to a type conersion failure,and it didn't add 0 record(s) to the table due to key violation, 0 record(s) due to lock...
|
by: pbd22 |
last post by:
Hi.
I am trying to insert a zero into the below table and I am being told
that:
Cannot insert the value NULL into column 'UsageToday', table
DB.dbo.Pub_Count'; column does not allow nulls. UPDATE fails. The
statement has been terminated.
What I am trying to insert is a string that I convert into an int
|
by: ghjk |
last post by:
I'm a new to postgres. i have a table which is having a colomn with auto increment value. When I insert value to that table, it gives an error.
First column is the auto increment one.
Could some one help me?
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |