473,666 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA code to C sharp

atksamy
91 New Member
HI,

I am trying to convert this code snippet which is in VBA to C sharp. Can someone guide me

Expand|Select|Wrap|Line Numbers
  1. Dim cn As New ADODB.Connection, cn2 As New ADODB.Connection
  2.                             Dim rs As ADODB.Recordset
  3.                             Dim rs3 As DAO.Recordset
  4.                             Dim connString As String
  5.                             Dim SelectFieldName
  6.  
  7.                             Set cn = CurrentProject.Connection
  8.                             SelectFieldName = astrFields(intIx)
  9.                             Set rs = cn.OpenSchema(adSchemaColumns, _
  10.                             Array(Empty, Empty, Empty, SelectFieldName))
  11.  
  12.                             'Exclude MS system tables '
  13.                             If Left(rs!Table_Name, 4) <> "MSys" And Left(rs!Table_Name, 4) <> "Abfr" Then
  14.                             strSql = "SELECT t.[" & astrFields(intIx) & "], t.fall from [" & rs!Table_Name & "] t Inner Join 01UMWELT on t.fall = [01UMWELT].fall Where [01UMWELT].Status = 4"
  15.                             End If
  16.  
  17.                             Set rs3 = CurrentDb.OpenRecordset(strSql)
Thanks
Feb 26 '09 #1
2 2982
Plater
7,872 Recognized Expert Expert
Look up using a database in your program.
Feb 26 '09 #2
targethelpdesk
1 New Member
Hi there,

A really useful tool for converting VB.NET to C# and back is provided by Telerik at the following url: http://converter.telerik.com/

Hope that helps,

Matt.
http://www.targethelpdesk.com
Feb 26 '09 #3

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

Similar topics

0
445
by: Vi | last post by:
Some of you might be interested in this open source AutoUpdater for ..NET "Sharp AutoUpdater provides an auto-update feature for .NET applications. Using XML configuration files, Sharp AutoUpdater component detects if there is a new version of the software, downloads, unzips, and installs the new files." Link: http://csautoupdater.sourceforge.net/
0
1519
by: application | last post by:
is it possible to create a simple com dll in c-sharp? i need to use a c-sharp com from an asp page( not aspx) and i read in google about regasm and csc and some other strage words but never find a full example of how to do it. Thanks
2
1988
by: Ben | last post by:
Hi all I am new to C Sharp. Any suggestion for some good C Sharp sites? Thanks for sharing. Ben
9
2348
by: Dragon | last post by:
Hi, I have 'some' experience in VB. I would like to learn C-Sharp and would like to know if the following book is any good or not. Thank you. Microsoft Visual C# .NET Step by Step - Version 2003 by John Sharp and Jon Jagger ISBN:0735619093
1
1320
by: Jet Leung | last post by:
Hello All: I want to rewrite a program by c sharp that was worte by vb. And I have a problem , how to translate "exit sub " of vb into c sharp? And how to run another program (for example a .exe file) in c sharp? I know it can be run by "shell " in vb. But how about in C shrp?
23
2290
by: arthur.mcginty | last post by:
Man I've grown tired with C#/.NET the last three days I spent trying to put a NULL value in a database. C# initializes all uninitialized properties to 0 (for numeric types) and didn't have until C# 2 any concept of NULLs. I keep wondering how you guys built all these .NET apps on the top of a database. And guess what? If you fail to initialize a DateTime (maybe because you just don't want to touch it!) you get it infact initialized to...
2
2433
by: ABC | last post by:
I have a very large amount VB code convert into C Sharp. I just complete it use tools. But it still have some codes errors. There are object to datatype problems. I need to edit many files to convert to as like as int.parse(obj), bool.parse(obj)..... Is there any good methods force C# can accept objects implicitly convert type object to the specific type without editing all codes.
5
1693
by: Alberto | last post by:
What sharp (from c sharp) stand for or where does it comes from? thank you
20
2608
by: windandwaves | last post by:
Hi Folk I am a PHP programmer, but I like to learn c-sharp as it seems to be in hot demand around here. My questions are: - how does c-sharp relate to PHP - do you like c-sharp and its cousins - are there better things to do then c-sharp? Thanks a million
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
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
8871
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...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
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
4198
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...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1776
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.