473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Can't get data

OK, I'm stumped.

I am getting the error: Exception Details:
System.Data.OleDb.OleDbException: Syntax error or access violation

on the last line (spBusinessUnit = cmdBusinessUnit.ExecuteReader()) when
trying to connect to a SQL Server 2K machine (this works with ASP):

<%@ Page Language="VB" Explicit="True" Debug="True"%>
<%@ import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>

Dim strConn As String
Dim cnnSearch As OleDbConnection
strConn = "Provider=SQLOLEDB;Data Source=MyServer;Initial
Catalog=MyDatabase;User ID=MyUser;Password=MyPswd;"
cnnSearch = New OleDbConnection(strConn)
cnnSearch.Open()

Dim spBusinessUnit As OleDb.OleDbDataReader
Dim cmdBusinessUnit As New OleDb.OleDbCommand("sp_web_Search
'FindBusinessProduct','','',''", cnnSearch)
cmdBusinessUnit.CommandType = CommandType.StoredProcedure
spBusinessUnit = cmdBusinessUnit.ExecuteReader()

--
Thanks in advance,

Steven
Nov 18 '05 #1
1 2012
Your OleDbCommand looks to be messed up. I am not sure if this is from
mistake in typeing or wrapping or what but it looks like you have way to
many parameters for the command object. As far as I know there are only 4
ways to do the command object.

New OleDbCommand()
OleDbCommand(CommandText)
OleDbCommand(CommandText, OleDbConnection)
OleDbCommand(CommandText, OleDbConnection, OleDbTransaction)

So for your code it should look like
Dim cmdBusinessUnit As New
OleDb.OleDbCommand("sp_web_SearchFindBusinessProdu ct", cnnSearch) 'watch for
wrap here it should be one line

Although I am not sure if your Sproc is actually called
"sp_web_SearchFindBusinessProduct".

-Stanley
"Steven K" <sk****@troop.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
OK, I'm stumped.

I am getting the error: Exception Details:
System.Data.OleDb.OleDbException: Syntax error or access violation

on the last line (spBusinessUnit = cmdBusinessUnit.ExecuteReader()) when
trying to connect to a SQL Server 2K machine (this works with ASP):

<%@ Page Language="VB" Explicit="True" Debug="True"%>
<%@ import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>

Dim strConn As String
Dim cnnSearch As OleDbConnection
strConn = "Provider=SQLOLEDB;Data Source=MyServer;Initial
Catalog=MyDatabase;User ID=MyUser;Password=MyPswd;"
cnnSearch = New OleDbConnection(strConn)
cnnSearch.Open()

Dim spBusinessUnit As OleDb.OleDbDataReader
Dim cmdBusinessUnit As New OleDb.OleDbCommand("sp_web_Search
'FindBusinessProduct','','',''", cnnSearch)
cmdBusinessUnit.CommandType = CommandType.StoredProcedure
spBusinessUnit = cmdBusinessUnit.ExecuteReader()

--
Thanks in advance,

Steven

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Andy | last post by:
Hi All! General statement: FK should not be nullabe to avoid orphans in DB. Real life: Business rule says that not every record will have a parent. It is implemented as a child record has FK...
1
by: George1776 | last post by:
Background: I have taken an excel spreadsheet with the formatting I want, saved it as XML, then converted it to an XSL document to use it as a sort of template. Added some for-each select...
4
by: sparks | last post by:
We have a database that reads in and formats raw data. We were using queries to format the data per person and outputing reports. The other database has the persons personal information. I changed...
2
by: DC | last post by:
Hi, I need to asynchronously read from a network (TCP) stream, and I am having trouble with retrieving whole blocks; I get a break in the data block every 1460 bytes which relates to network...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
4
by: Guadala Harry | last post by:
Is there any way for one Session to remove and update objects in another Session? I seriously doubt it, but thought I'd ask. Here's why: I have some data that is unique per user (or per session -...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
0
by: fiaolle | last post by:
Hi I have a combobox wich I set the Datasource,Displaymember and Valuemember at design time. I'm using a Dataset's table. But when I run the form the combobox isn't filled. Can't I set properties...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.