Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keyword not supported: 'provider'. 1

Status
Not open for further replies.

kefi2927

IS-IT--Management
Apr 3, 2003
40
GB
Can anyone please help me with this problem. The following code produces the error Keyword not supported: 'provider'.

Code:
<% @Import Namespace="System.Data" %>
<% @Import Namespace="System.Data.SqlClient" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
	Dim Connect As SqlConnection = New SqlConnection
	Dim Adapter As SqlDataAdapter = New SqlDataAdapter
	Dim ClassyDS As DataSet = New DataSet
	Dim ConnectString, SelectStatement As String
	Dim Category As String
	
	Category = Trim(Request.QueryString("Category"))
	
	If Category <> "" Then
		Header.Text = "Categories: " & Category 
		SelectStatement = "Select * From Ads Where Category='" & Category & "'"
	Else
		Header.Text = "Ad Listing"
		SelectStatement = "Select * From Ads"
	End If
	
	[COLOR=red][b]ConnectString = "Provider=SQLOLEDB;UID=defaultUser" & "Data Source=Kefi\NetSDK;Inital Catalog=classydb;"
	
	Connect.ConnectionString = ConnectString[/b][/color]
	Adapter.SelectCommand = new SqlCommand(SelectStatement, Connect)
	Adapter.SelectCommand.Connection.Open
	Adapter.Fill(ClassyDS, "Ads")
	AdsGrid.DataSource = ClassyDS.Tables("Ads")
	Page.DataBind
End If
End Sub
</script>

Thanks
 
You cannot use the provider keyword in a sqldataconnection, it assumes that you are using the sql provider. If you want to use the provider attrribute then you should use an oledataconnection or change your connection string like below

data source=(local);initial catalog=myData; UID=sa; PWD=mypass
 
Thanks for your help. I'm now getting the error message:

SELECT permission denied on object 'Ads', database 'classydb', owner 'dbo'

I'm running an SQL Server on my WinXP PC.

Could you give me any ideas?

Cheers
 
You should check that your user has the relevant permissions for your table in Enterprise manager. Do do this click on your sever then on your database

In the users area make sure that your user is assigned to the database. Then right click on your user and make sure that db_datareader and db_datawriter are checked.

If all of this is ok post back and i will some up with some more ideas.

 
Shatch. You are a STAR! All connections now AOK.

Thanks for your time & help.

Take care

kefi2927
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top