Click here to Skip to main content
13,050,617 members (87,414 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello i have a webform that user enter's data and data are saved in sql database by a click of a button.The form has some textbox,dropdoun menus,and radiobuttons.
I want to put in my form something like a search function when entering the value in primary key textbox (that is a car registration number and it is unique) if already exist then autoinsert in fields all data in form from database for update reasons, if not then i will do a normal insert and save.

Thanks in advance


ps sorry about my terrible english.
Posted 12-Nov-12 0:12am
ryanb31 12-Nov-12 8:41am
I am not sure I understand you but it sounds like you want to insert the record if it does not exist otherwise update? If so, in your SQL use the EXISTS keyword. IF EXSIST (SELECT * FROM table WHERE ID = @ID) BEGIN -- do the update END ELSE BEGIN -- do the insert -- END
joshrduncan2012 12-Nov-12 12:10pm
I think you are looking for AutoComplete and AutoSuggest. If so, Visual Studio can provide property settings for you. If you type something in and it's already in there, it will autofill for you, is this what you are looking for?
nikolas_ar 12-Nov-12 15:29pm
Yes but i want by typing something in the textbox must autofill all fields from the specific record.Its possible?
An example it would be a good help.
joshrduncan2012 12-Nov-12 15:37pm
Unless I'm missing something, I am reiterating setting AutoComplete and AutoSuggest for the textboxes to be enabled. I can't decipher anything else from what you are telling me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 12 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100