473,396 Members | 1,866 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,396 software developers and data experts.

Renaming a field in access table

i am renaming the field in access table but my module is sometime working sometime not working
Feb 14 '20 #1
1 2207
SioSio
272 256MB
It is how to changing the field name of mdb using vb.net and OleDb.
Expand|Select|Wrap|Line Numbers
  1.     Dim FileName As String = "your database path and filename"
  2.     Dim TableName As String     = "your table name"
  3.  
  4.     Using cn As New System.Data.OleDb.OleDbConnection
  5.     Using cm As New System.Data.OleDb.OleDbCommand
  6.     Using da As New System.Data.OleDb.OleDbDataAdapter
  7.     'change your Connection String    
  8.     cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & FileName & ";"
  9.     cm.Connection = cn
  10.     'change your table modify SQL
  11.     cm.CommandText = "ALTER TABLE tbl_name RENAME COLUMN old_col_name TO new_col_name ... ;"
  12.     da.SelectCommand = cm
  13.     End Using
  14.     End Using
  15.     End Using
  16.  
Feb 14 '20 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source...
2
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access...
6
by: Bernd Koehler | last post by:
Hi: I am a EE prof currently teaching an IT course. One the assignments students recently completed was designing a small MS Access Database. I have two submissions that are remarkably...
7
by: Marco Simone | last post by:
Hi, What is your opinion about using Lookup field in table. I would like to use lookup field in table 1, so that I can choose data in combo box from table 2. Is this good design of database? ...
4
by: JJ | last post by:
Hi, usually, I'm not using MS servers, but I have a big problem with a Access table. I should create a web application for a Historical Dipartment. They have created a populated a Access...
6
by: Paul | last post by:
I was wondering if anyone has had an issue where using vba code to read an excel file and import the data into an access table some records are not imported from the excel file. It seems looking at...
2
by: Tom Loach | last post by:
After reviewing the messages on google and using the Access 2000 developers handbook I came up with the following code to add a field to an access table. I'm working in Access 2002, and the code...
9
by: Shivam | last post by:
Hi All, I have a mysql dump file... something like. __________________________________________________ CREATE TABLE nation ( ip int(11) unsigned NOT NULL default '0', country char(2) NOT...
0
by: cbbibleboy | last post by:
Hey! I posted this first on the MS Access forum, but as I have not gotten any results, I wonder if it would fit better on the C# forums (overlaps between the two). I'm trying to rename a table in...
2
by: wardwebber | last post by:
I'm building an Access 2007 database by pasting field data from Excel 2007 into corresponding fields/tables in Access. The main Access table, AllDeathRecords, has an autonumbered primary key of...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
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...

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.