Automatic key assignment not working....

Hi,
  The automatic key assignment is trying to assign a null value to the primary key(AccountID) on saving the record causing an error. Line is bold.
Regards, Bob
CREATE TABLE [dbo].[AppGlobal](
[AccountID] [int] Identity (1,1) NOT NULL,
[AppID] [varchar](50) NOT NULL,
[AppPassword] [varchar](50) NOT NULL,
[AppNickName] [varchar](50) NOT NULL,
[AppCreateDate] [datetime] NOT NULL
) ON [PRIMARY]
Public Shared Function AddLogin(thisADB As AppDB, ByRef AuditHdr As auditHdr) As List(Of AuditLineItem)
Dim LineItemList As New List(Of AuditLineItem)
Dim LineItemSeq As Integer = 0
Dim connection As SqlConnection = BTDB.GetConnection
Dim insertStatement As String =
"INSERT AppGlobal " &
"(AppID, AppPassword, AppNickName, AppCreateDate) " &
"VALUES (@AppID, @AppPassword, @AppNickName, @AppCreateDate)"
Dim insertCommand As New SqlCommand(insertStatement, connection)
AuditHdr = New auditHdr
'AuditHdr.AuditID = 0
AuditHdr.AccountID = 999999
'Dim auditHdr As auditHdr
AuditHdr.CreateDate = Now
AuditHdr.TableName = "AppGlobal"
AuditHdr.Action = "A"
AuditHdr.ScreenID = gm_ScrID
Dim auditLineItem As AuditLineItem
insertCommand.Parameters.AddWithValue("@AppID", thisADB.AppID)
auditLineItem = New AuditLineItem
auditLineItem.AuditID = AuditHdr.AuditID
LineItemSeq = LineItemSeq + 1
auditLineItem.AuditSequence = LineItemSeq
auditLineItem.FieldName = "E-mail"
auditLineItem.BeforeValue = ""
auditLineItem.AfterValue = thisADB.AppID
LineItemList.Add(auditLineItem)
insertCommand.Parameters.AddWithValue("@AppPassword", thisADB.AppPassword)
auditLineItem = New AuditLineItem
auditLineItem.AuditID = AuditHdr.AuditID
LineItemSeq = LineItemSeq + 1
auditLineItem.AuditSequence = LineItemSeq
auditLineItem.FieldName = "Password"
auditLineItem.BeforeValue = ""
auditLineItem.AfterValue = thisADB.AppPassword
LineItemList.Add(auditLineItem)
insertCommand.Parameters.AddWithValue("@AppNickName", thisADB.AppNickName)
auditLineItem = New AuditLineItem
auditLineItem.AuditID = AuditHdr.AuditID
LineItemSeq = LineItemSeq + 1
auditLineItem.AuditSequence = LineItemSeq
auditLineItem.FieldName = "NickName"
auditLineItem.BeforeValue = ""
auditLineItem.AfterValue = thisADB.AppNickName
LineItemList.Add(auditLineItem)
insertCommand.Parameters.AddWithValue("@AppCreateDate", thisADB.AppCreateDate)
auditLineItem = New AuditLineItem
auditLineItem.AuditID = AuditHdr.AuditID
LineItemSeq = LineItemSeq + 1
auditLineItem.AuditSequence = LineItemSeq
auditLineItem.FieldName = "CreateDate"
auditLineItem.BeforeValue = ""
auditLineItem.AfterValue = CStr(thisADB.AppCreateDate)
LineItemList.Add(auditLineItem)
Try
connection.Open()
Dim insertCount As Integer = insertCommand.ExecuteNonQuery
Dim selectStatement As String =
"SELECT IDENT_CURRENT('AppGlobal') FROM AppGlobal"
Dim selectCommand As New SqlCommand(selectStatement, connection)
Dim AccountID As Integer = CInt(selectCommand.ExecuteScalar)
gm_AccountID = AccountID
If insertCount < 1 Then
LineItemList = Nothing
End If
Catch ex As SqlException
MessageBox.Show("SQL Server error #4 " & ex.Number & ": " & ex.Message, ex.GetType.ToString)
Finally
connection.Close()
End Try
Return LineItemList
End Function

See how to retrieve identity value through .net here
http://www.aspsnippets.com/Articles/Return-Identity-Auto-Increment-Column-value-after-record-insert-in-SQL-Server-Database-using-ADONet-with-C-and-VBNet.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • BlackBerry 9220 all the keys are not working & camera working Automatically

    Guys Please Help,
    My BlackBerry 9220 all the keys are not working (except end button)& camera working Automatically, i tried to update from desktop manager but the update reaches to 100 % & stucks. I tried 5 time but still it is not updataing. I m fedup from this phone, please help
    Regards,
    Taj

    Hi Taj151286
    Welcome to BlackBerry Support Forums
    Please run a Self Test on your Device to see if its an hardware issue , follow this Knowledge base :
    KB16037  : Using the Self Test application on the BlackBerry smartphone.
    If your device fails then you might have to look for warranty or repair options.
    Click " Like " if you want to Thank someone.
    If Problem Resolves mark the post(s) as " Solution ", so that other can make use of it.

  • "backspace", "g" and "h" keys are not working.

    hello,
    my laptop is HP 450 and windows 7.it is one years old. i haven't spilled anyting on it or damaed it in anyway i can think of.
    suddenly the "backspace" , "g" and " h " keys are not working. 
    please help me, because i have to complete my university assignment as soon as possible.
    tank you,
    shehara

    Hi,
    While this could be a hardware issue, it's always worth trying the following.
    Open windows Control Panel, open Device Manager, expand Keyboards, right click the entry 'Standard PS/2 Keyboard' and select Uninstall.
    Shutdown the notebook.
    Then unplug the AC Adapter and then remove the battery.  Hold down the Power button for 30 seconds.  Re-insert the battery and plug in the AC Adapter.
    Tap away at the esc key as you start the notebook to launch the Start-up Menu and then select f10 to enter the bios menu.  Press f9 to load the defaults ( this is sometimes f5, but the menu at the bottom will show the correct key ), use the arrow keys to select 'Yes' and hit enter.  Press f10 to save the setting and again use the arrow keys to select 'Yes' and hit enter.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • [S210 Touch] One key recovery not working

    I have a 1.25 year old S210 Ideapad Touch.  I made a 100GB partition with EaseUS and had no problem with onekey recovery.  I tried to merge that empty partition with my C drive using EaseUS software but it did not work saying there were errors.  After that attempt One Key did not work.  Tried to open One Key with compter turned off, error message said damaged partition. Next I used Control panel Administrative Tools: Disk Management to return C drive to almost its original size less 350 mb. one key still did not work.  I reinstalled one key from Lenovo website and still did not work. Still indicated damage partition.  What can I do now?
    Jim
    Moderator comment: New thread created. Subject edited for clarity. Was: Re: One key recovery not working!

    I found the following on a recovery disk which I made early last year for the  same computer but I cant get it to boot.
    How do I boot this usb flash drive without losing this material and is it used to recreate the correct partitions?
    convert gpt
    create partition primary size=1000
    format quick fs=ntfs label="WINRE_DRV"
    assign letter="W"
    gpt attributes=0x8000000000000001
    set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    create partition efi size=260
    format quick fs=fat32 label="SYSTEM_DRV"
    assign letter="S"
    create partition efi size=1000
    format quick fs=fat32 label="LRS_ESP"
    assign letter="I"
    gpt attributes=0x8000000000000001
    set id="bfbfafe7-a34f-448a-9a5b-6213eb736c22"
    create partition msr size=128
    create partition primary size=436224
    format quick fs=ntfs label="Windows8_OS"
    assign letter="T"
    create partition primary
    format quick fs=ntfs label="LENOVO"
    assign letter="O"
    shrink minimum=12288
    create partition primary
    format quick fs=ntfs label="PBR_DRV"
    assign letter="Q"
    gpt attributes=0x8000000000000001
    set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    exit
    Thanks for any help,
    Jim

  • New Apple Keyboard Launchpad F4 key does not work

    New Apple Keyboard Launchpad F4 key does not work
    Hi, I have now got ne new wireless keyboard because my old one broke. I connected the keyboard, the F3 key (Mission Control) functions, the F4 key, especially for Lunchpad does not work, I'm Lion on it, previously on the old keyboard I had in 2009, he occupiedwith Launchpad F5.
    Have System Preferences / Keyboard / Keyboard Shortcuts reset everything goes ......... but not yet!!
    Maybe someone can help me!!
    Thank you
    greeting

    Hi,
         Your migration to Lion brought over a previous hot key preferences document. And this contains one bad key that wasn't updated.
    - Quit System Preferences (if open)
    - Delete this document to remove a carry-over mapping error.
    - Then logout
    Note: That this will delete any existing modified keyboard assignments. Re-assign changes manually.
    Note2: This document is in your users preferences folder.
    ~/Library/Preferences/com.apple.symbolichotkeys.plist
    -Alan

  • F4 help key does not work in ESS on ITS in Portal

    Hello All,
    F4 help key is not working in all iviews in ESS in Portal.When i try to press it nothing happens and no pop up appears,kindly please suggest wt might be the cause of this error? Iam tired struggling with this issue and not able to trace out reason for the same.My Email Id is [email protected] .Plz revert at earliest.
    regards,
    Saumya

    Hi,
      This kind of problem is known when webgui is being started from an IAC, e.g. HRWPC_FC_EXEC
    You have to set parameter ~webgui_popups 1 in the service file of this IAC.
    BR,
    Disha.
    Pls reward points for helpful answers.

  • ABAP/4 Key is not working in BI 7.0 version

    Hello,
    Some reason my ABAP/4 key is not working on BI 7.0 few months back I created few ABAP programs
    When i try to create a new program using t-code SE38 and program name as 0201 then create button then system will ask ABAP key when i enter its giving error message "incorrect entry"
    What would be the reason?
    Thanks

    well, normally a report has to start with Z or Y. So what key is system asking for? Developer key, which you have already entered a few month ago, or a 'modification' key?
    Are you creating this report with the same user name?
    Have a look at table DEVACCESS in transaction SE11. here you will find all the users and there developer keys.
    Are you creating these report on the same installation as a few month ago, or did something change in the mean time?
    Edited by: Micky Oestreich on May 6, 2008 10:01 PM

  • Modifer keys do not work with mouse in Illustrator

    Below is a copy of a bug report I just submitted to Adobe. I don't suppose any users have run across this and found a solution or workaround?
    I found someone else with this problem in an archived topic thread, but the only response that poor fellow got was an accusation of not following instructions (His problem wasn't user error, BTW).
    Thanks
    ******BUG******
    Concise problem statement:
    Modifer keys do not work with mouse: For example, free transform or rotate behaviors that require "Click-Ctrl" .
    Steps to reproduce bug:
    1. select object
    2. select free transform tool
    3. left click (without releasing) a corner of the bounding box.
    4. start dragging
    5. press ctrl
    Results:
    object behaves as though the ctrl key was not pressed. i.e. the cursor does not change shape and the object scales rather than distorts.
    Expected results: The cursor should change shape as the ctrl key is pressed and the object should distort rather than scale.
    Additional information: This behavior is intermittent. Occasionally Illustrator recognizes the "Click-Ctrl" combination and behaves exactly as the help file predicts it will. The cursor changes shape and the object distorts rather than scales. I can offer no rhyme or reason for when Illustrator will behave as advertised and when it will ignore the modifier keys.
    The example above involves the free transform tool, but the problem occurs just as often with other tool behaviors that require a modifier key + mouse combination.
    Primarily using Wacom Intuos3 tablet. (with latest drivers), but have also tried combinations with microsoft mouse or both mice installed.
    Also, immediately after an occurrence Illustrator bug, left AI open, went to a different app that uses mouse+modifier (Ctrl+Click). That different app recognizes Ctrl+Click with no problems whatsoever.

    Thanks Guys,
    Good to know it's working for you. I guess that's the nature of intermittent bugs. Of course, Adobe's bug report form has a field for version, which I, of course, filled in. Sorry I didn't add it to this post. I'm using the latest version CS3 v13.0.2.
    Stephen,
    Sorry I was not more clear when I said, "For example, ...". I was talking about the modifier keys not working with several different tools. The Free Transform tool advertises functionality that is supposed to work with a "Click (down, but don't release)then hold down Ctrl" combination. The Rotate tool advertises a behavior that is supposed to work with an "Alt-Click" combination. These are just 2 examples of the modifier keys not working. I focused primarily on one example in the bug report(ctrl after and in addition to click in the free transform tool, not alt-click in the rotate tool).
    Here is what I expect(quoted from Adobe's CS3 help file)
    (From the "Distort Objects with the Free transform tool" help topic)
    "Select one or more objects.
    Select the Free Transform tool .
    Start dragging a corner handle on the bounding box (not a side handle), and then do one of the following:
    Hold down Ctrl (Windows) or Command (Mac OS) until the selection is at the desired level of distortion.
    Hold down Shift+Alt+Ctrl (Windows) or Shift+Option+Command (Mac OS) to distort in perspective."
    (from the "Rotate an object by a specific angle" help topic:)
    You can control the exact angle of rotation with the Rotate command.
    Select one or more objects.
    "Do one of the following:
    To rotate around the center point, choose Object > Transform > Rotate, or double-click the Rotate tool.
    To rotate around a different reference point, select the Rotate tool. Then Alt‑click (Windows) or Option‑click (Mac OS) where you want the reference point to be in the document window.
    Enter the rotation angle in the Angle text box...."
    These Tool based mouse-key combinations do occasionally work as they are supposed to, so I know what the expected results are supposed to look like, but whether they work or not appears to depend on the phase of the moon, the day of the week, and the color of the president's underwear.
    Other non-tool based mouse-key combinations in Illustrator work consistently all the time - Ctrl-A for Select All as just one example that always works.
    Thanks Again

  • My number 5 key is not working and my password has a number 5 in it. How can I change my password when I'm signed in on another account or as guest user? I need help :(

    My number 5 key is not working and my password has a number 5 in it. How can I change my password when I'm signed in on another account or as guest user? I need help

    - If the "other" account has administrative privileges then just try changing the PW for your account.
    - Forgot Mac Password? How to Reset Your Mac Password (with or without CD)
    Change the Admin Password with Mac OS X Single User Mode
    Reset mac mini admin password: Apple Support Communities
    - If the problem is due to a bad KB just get a new KB

  • Function keys are not working correctly

    I've been looking all over the various threads and I can't find an answer that solves my problem.
    Here are the details:
    I bought the computer in the U.S. where I live.
    I have a iMac 2.4GHz intel Core 2 Duo  EMC 2133 with a 20" screen. Bought it new in February 2008.
    I have Mac OS X 10.5.8  (I am waiting for my order for OS Snow Leopard to come in!!)
    I have been using a wireless mouse and Keyboard (Love not having cords!)
    Recently, my wireless keyboard got a short and quit working. I went down to the apple store and got a new wireless keyboard.
    I had the computer with me at the genius bar so, yes, the apple employee saw exactly what I have.
    I took it all home got the thing all put back together and got the new keyboard paired up and working with the computer.
    Here are the problems:
    Went to go use the function keys while using iTunes and found they weren't working properly. The F10, F11 and F12 do not control the volume of sound as the keyboard indicates they would, they instead activate dashboard, spaces, and application windows. 
    Following the advice of other threads, I looked over in the system preferences and made sure the "Use all F1, F2 etc." box was unchecked (it was unchecked), things still didn't work.
    I tried the fn key but it appears to not work at all it has no effect on the functioning of the function keys.
    I went under keyboard shortcuts in system preferences and found the F10, F11 and F12 keys, it confirms that those keys control spaces, dashboard and application windows as they are performing but shows no options to either reassign to volume control (as marked on the keyboard) or make the fn key work.
    I've gone back and forth trying various combinations of checked and unchecked boxes to see if anything would work, so far I've come up with nothing.
    A couple more important or interesting facts:
    Yes I have turned off and taken the batteries out of the old keyboard. My bluetooth connection currently shows it as disconnected.
    I have restarted the computer.
    One thing I find odd; when I go under preferences and go to Keyboard and Mouse when I go under the section "Bluetooth" it shows Bluetooth mouse with the name of the mouse and the battery level. BUT nothing is showing up under bluetooth Keyboard, I can't figure out how to change this and don't know if it is contributing to the problem.
    When I go under the bluetooth logo on the top bar I find the mouse and both keyboards referenced, the old keyboard is shown as disconnected and the other two are connected. I have tried to update the device's name but it doesn't seem to let me.
    I have double clicked on the device under bluetooth and it shows the new keyboard as discoverable, paired and connected. Hence, I am using the new keyboard to write this inquiry.
    Please, any assistance would be of great help. I have tried to be thorough in order help narrow the possible problem. Thanks!!

    Hendry
    Just thought I'd let you know.  Our suspicions were correct, it was the OS. After I installed Snow Leopard (10.6.8) all the problems were corrected.  I also updated the RAM from 1 gb to 6 gb. The mac is working all around better. Sorry it took so long to get back to everyone. My superdrive had pooped out. Rather than replace it I got an external drive from OWC connected with firewire 800.  So far everything is running very well, as far as I can tell this external drive is better than the original superdrive. My superdrive has always acted funny, infact I returned the first mac I got after a week because its superdrive was also malfunctioning. Anyway, all that to say everything seems to be fully functioning again.
    Roy
    Re: Function keys are not working correctly 

  • The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.

    The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.

    The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.

  • The 1 key does not work on my wireless keyboard what do i do?

    Hi i had a usb keyboard for a while and the 1 key did not work but i could but use the numbers on the right side of the keyboard but we just got a wireless keyboard that doesnt have the other numbers on the right side so we cannot use the number 1. But it will work in the login window and on other accounts. i do not know how to fix it, what do i do?

    Hello:
    If I understand you, the number one key works some places, but not others.  This is true of the wireless KB as well as the old wired KB. 
    If I do understand, let us know.  If what is happening is different, post the correct information, please.
    Barry

  • Function keys do not work on new wireless keyboard

    Hello....my good friend just bought a new iMac G5 2.1 spotlight model computer and has had troubles with his new wireless keyboard in that all 16 function keys do not work at all. Got any ideas or is it just a defective keyboard? He bought this at my recommendation so i am trying to make it all work smoothly for him. Would appreciate a quick response as he has now had this mac for 2 weeks and we cannot figure out the problem. Thanks in advance for any and all help

    I have no issues using the Apple BT keyboard. All function keys that apply to the iPad work correctly; display brightness, iPod app control, etc.
    Use the most recent version of iOS and also iTunes on your computer. Try a reset. Press & hold the Power and Home buttons together for 10+ seconds, ignoring the red power-off slider, until you see the Apple logo.
    If that  does not work, then restore the iPad to it factory settings.

  • My laptop keyboard is having problems. I took it if to change my bottom case it worked fine prior and then after just the power key worked. I cleaned everything nothing is bent in the cable. now my power key is not working

    Hi my keyboard is not working I took off the bottom case to change it prior my keyboard was fine and after just the power key worked. I checked everything no portions were bent and it plugged in good. I tried to turn it on this morning and now the power key doors not work??

    Back up all data.
    Triple-click anywhere in the line below to select it:
    pmset -g assertions
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    Post any lines of output that appear below what you entered — the text, please, not a screenshot.

  • The enter key is not working in firefox but it has working fine in chrome and IE so please help me to rid out from this.

    The enter key is not working in firefox but it has working fine in chrome and IE so please help me to rid out from this.

    Hello gokulaan, '''try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

Maybe you are looking for