Click here to Skip to main content
12,290,988 members (54,975 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
i can use following code but not work in VB.NET
Using System.Data.SqlClinet;

SqlConnection con;
SqlCommand cmd;
Posted 1-Nov-11 3:53am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You are using C# Syntax.

Have a look at below link for VB.Net syntax.
http://www.daniweb.com/software-development/vbnet/code/216920
  Permalink  
v2
Comments
Espen Harlinn 1-Nov-11 13:21pm
   
Nice link, my 5
RaisKazi 2-Nov-11 0:47am
   
Thank you Espen. :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try

Dim con As New SqlConnection()
Dim cmd As New SqlCommand()
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

If you need help with connection strings, go to http://www.connectionstrings.com/[^]. You can pick up the right database you are looking for.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

using cn as new sqlconnection(ConnectionString)
end using

or

dim cn as new sqlconnection("ConnectionString")


Have a read of this article it will show you how to make a connection to a SQL Server database. MSDN: Sqlconnection[^]

This article will show you how to execute a command against the database using sqlcommand MSDN: Sqlcommand[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160518.1 | Last Updated 1 Nov 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100