Connecting VB .NET with SQL Dbase

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 1
Reputation: etenge is an unknown quantity at this point 
Solved Threads: 0
etenge etenge is offline Offline
Newbie Poster

Connecting VB .NET with SQL Dbase

 
0
  #1
Sep 11th, 2008
Help me with the code or tutorial on how to connect vb .net with sql. dbase. thank you
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Connecting VB .NET with SQL Dbase

 
0
  #2
Sep 11th, 2008
Have you ever tried googling?
http://www.google.com/search?q=VB.NE...ver%22+connect
gave a plenty of examples.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 3
Reputation: savi3 is an unknown quantity at this point 
Solved Threads: 0
savi3 savi3 is offline Offline
Newbie Poster

Re: Connecting VB .NET with SQL Dbase

 
0
  #3
Sep 11th, 2008
Import the SqlClient first.

Then Establish the connection by
  1. Sqlconnection conn=new Sqlconnection();
  2. SqlCommand cmd=new SqlCommand("Query",conn);
  3. cmd.ExecuteNonQuery();
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Connecting VB .NET with SQL Dbase

 
0
  #4
Sep 11th, 2008
See this site....
There are all about connection string to databases..
Just looking what you needed there.
Last edited by Jx_Man; Sep 11th, 2008 at 12:05 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 36
Reputation: Alexpap is an unknown quantity at this point 
Solved Threads: 0
Alexpap Alexpap is offline Offline
Light Poster

Re: Connecting VB .NET with SQL Dbase

 
0
  #5
Sep 11th, 2008
A simple Insert Statement Function made by me for another project.

  1. Function Insert(ByRef Conn As OleDbConnection, ByRef connection_string As String, ByRef Transaction As OleDbTransaction, ByRef ConnCommand As OleDbCommand, ByRef CommandText As String)
  2. Dim da As New OleDbDataAdapter
  3.  
  4. Conn = New OleDbConnection(connection_string)
  5.  
  6. Conn.Open()
  7.  
  8. Transaction = Conn.BeginTransaction
  9.  
  10. ConnCommand.Connection = Conn
  11. ConnCommand.Transaction = Transaction
  12.  
  13.  
  14. ConnCommand.CommandText = CommandText
  15.  
  16. Try
  17. da.InsertCommand = ConnCommand
  18. da.InsertCommand.ExecuteNonQuery()
  19.  
  20. Transaction.Commit()
  21.  
  22. MessageBox.Show("Saved succesfully", "Adding Data", MessageBoxButtons.OK, MessageBoxIcon.Information)
  23.  
  24. Catch ex As Exception
  25.  
  26. Transaction.Rollback()
  27. MessageBox.Show(ex.Message)
  28.  
  29.  
  30. End Try
  31.  
  32. Conn.Close()
  33. ConnCommand.Dispose()
  34. da.Dispose()
  35. Transaction.Dispose()
  36.  
  37. Return Nothing
  38. End Function

Hope i helped!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC