473,737 Members | 8,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Ms-Access Field data type thru VB.Net

5 New Member
Hi All,

I am using VB.Net 2003 and Ms-Access 2003. I want to change the data type of fileds programmaticall y. I could not find any method in vb.net to do this.

i) I tried using the sql query "ALTER TABLE TableName ALTER COLUMN FieldName Number" It works for data type like 'Number', 'Memo' etc. But if I want to change to 'Long Integer' (sub type of Number), it does not work.

ii) I tried using ADOX as shown below. It shows the 'Operation is not allowed in this context' error on "adox.Tables(Ta bleName).Column s(FieldName).Ty pe = NewType"

Dim conn As ADODB.Connectio n
conn = CreateObject("A DODB.Connection ")
conn.Open(Conne ction.Connectio nString)
Dim adox As ADOX.Catalog
adox = CreateObject("A DOX.Catalog")
adox.ActiveConn ection = conn
adox.Tables(Tab leName).Columns (FieldName).Typ e = NewType)
adox.Tables.Ref resh()
conn.Close()

What am I doing wrong here? Is there any better way to do this? Please somebody help me as this is to be done urgently.

Thanks,
Bala
Apr 13 '07 #1
2 2926
tifoso
41 New Member
Alter Table goes thru the SQL layer which is not fully supported. This may or may help you but is worth the shot. In access turn on the macro recording, then change the type and stop the recording. Now "edit" the macro and you'll see how access needs it or it will give you a hint on how to proceed It saved me a couple of times since sometimes , or should I say lots ;-) , they do funny stuff.

Ciaoi
Apr 14 '07 #2
balaki
5 New Member
Thanks for your reply.
But I am not sure, how can we record macros in MS-Access (2003). Can you please let me know how can we do this. The following url says, it is not possible.

http://www.ureader.com/message/1603951.aspx

Bala
Apr 16 '07 #3

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

Similar topics

2
2142
by: Gary | last post by:
We have had to change the hostname on an SQL server (Blade and the blade moved chassis so name changed) was blade-0-1-5 and is now blade-0-0-12 It seems i need to run 2 stored procedures which are sp_dropserver 'blade-0-1-5', 'droplogins' go sp_addserver 'blade-0-0-12', 'local' go
4
17691
by: Ronny Sigo | last post by:
Hello all, I am trying to programmatically change the orientation of a MS Word Document to landscape. I must be doing something wrong cause it does not work ... can anybody help me with this? Code is below .... Much obliged ... Ronny Sigo Dim appWD As Object Dim myDoc As Object
1
16869
by: Anthony Boudouvas | last post by:
Hi to all, i have a treeview that i put some nodes in it with their repsective images. If i try to change the image and set it to some other ImageList index, nothing happens. The code i use is: private void ChangeServantStatus(string servant, ServantStatus status) {
9
37206
by: Christian Blackburn | last post by:
Hi Gang, In VB6 is was relatively easy to change the pointer, but now I don't even see that as a property for any objects. Can somebody tell me how to do that in .NET? Thanks in Advance, Christian Blackburn
7
7442
by: Richard Bond | last post by:
Hi Is there anyway to change the characterset/codepage of a specific textbox on a winform. I have read in a "chinese traditional big5" file into memory using a streamreader with the appropriate codepage SR = New StreamReader(TBLFilename, System.Text.Encoding.GetEncoding(Cube.CodePage))
5
16634
by: GY2 | last post by:
I want to step through the rows returned by my DataView, extract some values from some of its columns and append them as separate lines to the text of various rich textbox controls while possibly changing the color of each new line. It seems as though I should use the Lines property but can't find a good example. Below is my attempt to do it with the .Text property (which doesn't work because no colors are displayed). I have also tried...
4
1508
by: WXS | last post by:
In a case you have Project/Assembly A references Project/Assembly B which References Project/Assembly C. Let's say Project A needs be and references it directly. Unknown to A, B needs project C's assembly but it uses C's assembly dynamically (Load Assembly). Even with copy Local set on all references Project A when built will get project B's output but not project C's. This is from what I hear due to an "enhancement" in VS2005, that...
3
1603
by: srinivasarv | last post by:
Dear Friends, I want to know how we can change the format of the amount in indian style in MS Acess. Ex : 22,12,24,225/- (Indian style) 221,224,225/- (Foreign style) I want to change the format of the amount in indian style. Please help me in getting the solution
3
5043
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, we've got a strange problem here: We've created an ASP.NET 2.0 web application using Membership.ValidateUser() to manually authenticate users with our website. The problem is: If the user has the "User must change password" flag set in Active Directory, ValidateUser() always returns false if that user wants to log in.
5
11685
by: Rainmanjam | last post by:
I have a web site that uses MSN Live Maps. It works in Opera if I change the User Agent to IE. Is there a way to change the User Agent via Javascript for one page?
0
8786
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9470
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9258
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9207
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6052
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.