Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 4: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 at 1-Nov-11 13:21pm
   
Nice link, my 5
RaisKazi at 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
0 Sergey Alexandrovich Kryukov 9,455
1 OriginalGriff 8,295
2 Peter Leow 4,839
3 Kornfeld Eliyahu Peter 3,210
4 Maciej Los 2,301


Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 1 Nov 2011
Copyright © CodeProject, 1999-2015
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