473,322 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

SQL database problem

I have this probelm
In table of my SQL database I have column which should contain text, which
contains the ID of the row in Dataset.

My table has this columns
ID
Date
Time
UniqueID
Status
..... etc.

I want the column UniqueID to contain the ID of the row and some text, like
"ABC000" where the 000 is ID of the row. Also every new row, inserted in
the table has ID which lenght is variable. The first row has ID 1 and
lenght1, the 12th row has ID 12 and lenght of the ID 2.
I want may UniqueID to be with speciefied lenght of 8 chars, so some leading
zeroes should be inserted. The final result should be "ABC00012" for the
12th row.
The UniqueID filed in my table can't be NULL.
So when I add new row to a table, somehow I should know what will be its ID.
I can determine it in dataset, it is +1 of the rows count in dataset, but
when it's commited to the database, it may get new ID. I made a Stored
procedure, which puts a temporary value in UniqueID column, add new row to
table with this temp value, then reads row ID and makes modification of
UniqueID column, by replacing it with the generated value from the real ID.
This works fine.
The main problem is, how to generate this UniqueID in the moment that user
adds a new row to dataset.
My app look something like this. There is a readonly datagrid, binded to
dataset and some buttons like "Add record", "Remove record" and etc. When
user clicks on the "Add record" button, a new form loads, where user can
enter the needed information. This windows is the place, where I need to
show the user this UniqueID, but it does not exist at this time, because the
row is not in the database yet. Like I said, I may generate it from the
current count of the rows in dataset, but it may differ when commited to
database.
Any ideas?
Nov 21 '05 #1
0 841

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

Similar topics

1
by: John Mullan | last post by:
Hi I have a problem creating a backup in SQL Server 6.5. Although, the backup produced does restore ok, I want to stop this error message appearing everytime I make a backup. The error message is:...
2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
5
by: lappy | last post by:
Hello, I have written a small programme to compact an access 97 database. Dim je As New JRO.JetEngine ' Compacts database Data.Mdb to Data2.mdb. je.CompactDatabase...
2
by: barbara_dave | last post by:
Hi, All, I have an existing access database. It can't be added more data and its size is 32mb. I wonder it is full. I use access utilities to repair and compact it, but I got error message...
16
by: Orchid | last post by:
Hello, I have a MS. Access database in XP. When I open the database in design view, users will get an error message & cannot even open the database. Is there any way to solve this problem? ...
0
by: Tommy Christian | last post by:
Hi! Anyone who knows about saving serialized data to database, coz I have a problem with that. If I just serialize my session data and then deserialize it, it works. But when I save it...
0
by: richard | last post by:
OS: Winxp and Win2003 Visual Basic.NET 2003 MS-SQL Server 2000 hey all I am a newbie in vb.net but i have managed to build a simple chat server in vb.net using socket and a client connecting...
2
by: M.A. Oude Kotte | last post by:
Hi All, I'm unsure if this is the correct mailinglist for my question. I have a problem with CREATE DATABASE, but as the docs state that officially this is not an SQL statement, I was unsure if...
3
by: ATXTech | last post by:
I am using a Access created database with a program I wrote in C# to create and track helpdesk tickets. I store basic stuff like customer name, number, issue, tech assigned, etc. with in the...
1
by: =?Utf-8?B?TWFya0F1cml0?= | last post by:
Im trying to help a friend who is attempting to deploy an asp.net 2.0 app. She wants to use the membership/role system, and the necessary database and its tables, etc, exist in the sql server 2000...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.