• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Acess VBA code conversion to C# using LINQ to SQL

Joined
12/16/07
Messages
29
Points
11
Hey guys,

I have a project which requires me to change some Access VBA code into C# code using LINQ to SQL. Does anyone have any suggestions on how to proceed on this?? Does Microsoft Visual Studio 2008 or 2005 have any functions like that ??

Your comments are much appreciated :tiphat:
 
Make sure you have .NET 3.5 for the latest libraries that supports LINQ. Using LINQ-SQL in C# is a blast. I use VS2008 so I don't know how VS2005 is wrt LINQ
Here is some example code
C++:
using System;
using System.Linq;
using System.Data.Linq;
using nwind;
Northwind db = new Northwind(@"Data Source=.\SQLEXPRESS;Initial Catalog=Northwind");

var custs =
  from c in db.Customers
  where c.City == "Rio de Janeiro"
  select c;
foreach (var cust in custs)
  Console.WriteLine("{0}", cust.CompanyName);

The tasks that you have to do now is to get a connection string that will connect to your SQL server from the Access/VBA string.
 
Back
Top