Sql provider instead of access OLEdB

bonhomme

Member
Joined
Oct 23, 2008
Messages
8
Programming Experience
Beginner
I am new in VB.NET I am now busy doing some exercises i want to move forward with Sql DataBase, so can someone explain me how to chose provider connection with Sql. below is the connection procedure I have been using so far

Imports System.Data.OleDb
Imports System.Runtime.Serialization.Formatters.soap
Public Class customerData
'Private Shared customers As New ArrayList()
Shared conHanDler As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\VB.NET\CustomerDB.mdb")

I would like to know how to change this line dealing with real Sql server Database

Any help please?
OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\VB.NET\CustomerDB.mdb")
 
"Data Source=HEADIT\SQLLOCAL;Initial Catalog=Address;Persist Security Info=True;User ID=sa;Password=logs1lumber"

replace HEADIT\SQLLOCAL with your server name
password logs1lumber with your own password

you don't need the provider
 
Thank you for your help but the problem is the connection. How do I make the connection with the Database from the server?
 
Create a DataAdapter for a Sql table

I want to create a DataAdapter for a Sql table. I have been using

"Dim My_DataAdapter as new OleDbDataAdapter(sql, ConnectionString)" to deal with access Database

But it seems this statement doesn't work with Sql database

I am just new in VB.Net I know how easy such thing thing is in Visual Foxpro

Any help
 
I am busy with a webform after trying to connect with the script below

Protected Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ConnectHandler
ConnectHandler = "Data Source=FAXCOOLWAREZ037;Initial Catalog=Accout;Persist Security Info=True;User ID=sa;Password=dieudonne"
Dim My_Dataset As New DataSet()
'Declare an instance SQL statement
Dim sql As String
sql = "Select * from AccountTBL "
'Declare a new instance of dataset
'Select command and connection command
Dim objDA As New SqlDataAdapter(sql, ConnectHandler)


If My_Dataset.Tables("AccountTBL").Rows.Count > 0 Then
Dim CustRow As DataRow
CustRow = My_Dataset.Tables("AccountTBL").Rows(0)

TextBox1.Text = "yes"
End If

I received this error message on the variable "Dim objDA" there is the error message
"Overload resolution failed no accessible "New" can be called without a narrowing conversion. What is the meaning?

Any help please



' My_DataAdapter.Fill(My_Dataset, "Customer")
'DataGrid1.DataSource = My_Dataset.Tables("Customer").DefaultView
'TextBox1.Text = My_Dataset.Tables("AccountTBL").Rows(0).Item("AccountNbr")

End Sub
 

Latest posts

Back
Top