PDA

Click to See Complete Forum and Search --> : Interchanging Record in Database


smyasin
Dec 6th, 2005, 02:45 PM
I am using SQl database

Table Name is : User

structure of the table is

CODE NAME

1010 ABC
1020 XYZ
1030 NIY

CODE Field is Primary Key

PHysically i want to interchange the records. For this I want to implement the following steps in VB

Assigning record to a variable
X = Source Record (any one Record)
Y = Target Record (another record)
Z= Empty

Interchaing the record
Source Record = Z
Target Record = X
Source Record = Y

This is i want. Please can u help how to do this with VB


thanx in advance

by
yasi
:confused:

AIS4U
Dec 6th, 2005, 07:41 PM
smyasin:

It is hard to figure out just what it is that you want to do.

Usually, when you use a database, you INSERT information into the database; UPDATE or EDIT information that is already in the database; SELECT certain information from the database and things like that.
I don't really understand when you say you "want to interchange records?" And that you want to do it by assigning certain records to varaibles?

Have you made a connection to your database?

That would be one of the first things you would need to do.
The code for doing that would be something like this:
[Visual Basic Code]-----------------------------------------------------
ConnectionString = "Provider=SQLOLEDB.1; User ID=sa; password=; & _
"Initial Catalog=YourDatabaseName"
[/Visual Basic Code]-----------------------------------------------------

After you have connected to your database you can write code to do whatever it is you want to do such as display certain fields in textboxes, datagrids, or controls such as that.

Then you could change any of the information in any of the fields and UPDATE your database.

I don't have any idea how many records are going to be in your database, but if it is just a very few perhap yo don't need a data base and could use an array instead.

Perhaps if you would post a little more information someone here can help you do whatever it is you want to do.

I am not sure that this helps you a lot, but I can't really tell you a whole lot more without knowing more about what you are trying to do.

Good Luck