473,732 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft Access Query and VB.Net function.

Hello,

I have the tables content and content_localiz ed in a Microsoft Access
database.

I created a Query in my Microsoft Access database named
"content_SELECT ":

SELECT content_localiz ed.content_html
FROM content INNER JOIN content_localiz ed ON content.content _id =
content_localiz ed.content_id
WHERE (((content.cont ent_page)=[@Page]) AND
((content.conte nt_name)=[@Name]) AND
((content_local ized.content_cu lture)=[@Culture]));

I tested the Query inside Microsoft Access and it worked fine returning
the expected record.

On my Asp.Net 2.0 web site I created a function which should execute
the Query "content_SELECT " and return value on field
content_localiz ed.content_html .

My function code is as follows:

---------------------------------------------------------------------------------
Public Function Load()

' Set Connection
Dim connectionStrin g As String =
ConfigurationMa nager.Connectio nStrings(_Conne ctionString).Co nnectionString
Dim connection As New
System.Data.Ole Db.OleDbConnect ion(connectionS tring)

' Set Command
Dim command As New System.Data.Ole Db.OleDbCommand
With command
.CommandText = "EXECUTE content_SELECT"
.Connection = connection
.CommandType = CommandType.Tex t
End With

' Add Parameters
With command.Paramet ers
.Add(New OleDb.OleDbPara meter("[@Culture]", "pt-PT"))
.Add(New OleDb.OleDbPara meter("[@Page]", "Default.aspx") )
.Add(New OleDb.OleDbPara meter("[@Name]", "Newsletter "))
End With

' Execute the Command
connection.Open ()
Dim contentHtml As OleDb.OleDbData Reader = command.Execute Reader
If contentHtml.Rea d Then
Return contentHtml.Ite m("content_html ").ToString ()
Else
Return "Something is Wrong" ***
End If
contentHtml.Clo se()
connection.Clos e()

End Function
---------------------------------------------------------------------------------

My page doesn't display any error but the function returns the string
"Something is Wrong" from my code line ***

I tried everything I could think of to solve this problem.

Could someone, please, help me out?

Thanks,
Miguel

Sep 14 '06 #1
0 1436

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

Similar topics

4
18058
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out on me for some reason. The Summary field is pulled from a Rich Text Editor that allows HTML formatting and appears to be the culprit, but I just can't seem to figure out why. Any guidance is greatly appreciated. I'm connecting to an Access...
14
5416
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why I get worse response time when the optimizer uses two indexes, than when it uses one. Some context:
7
1680
by: Julia Baresch | last post by:
Hi everyone, My company recently upgraded from Office 97 to Office XP. As those who've read my other posts know I have a database with 3 nested subforms Main form-->First Subform-->Second Subform First subform is a subform of Main Form, and Second Subform is a subform of First Subform.
11
3564
by: DFS | last post by:
Architecture: Access 2003 client, Oracle 9i repository, no Access security in place, ODBC linked tables. 100 or so users, in 3 or 4 groups (Oracle roles actually): Admins, Updaters and ReadOnly. Each group sees a different set of menu options when they open the client and login to Oracle. For the sake of speed I use pass-through queries here and there for updates and deletes. I update their SQL property in code and execute them.
1
2019
by: Nikhil | last post by:
Hi, I have defined a module called "Utility Functions" in MS-Access. In that module, I have defined a function called NullToZero. I used this function in one of my stored Queries in Access. This works fine when I run the query in Access itself. Now, when I call the query from Visual Basic through an OleDbCommand and an OleDbConnection, I get the exception: "undefined function in expression" Is there a special way to call Modules in...
6
5477
by: InnoCreate | last post by:
Hi everyone. I've recently written a classic asp website which uses an MS Access datasource. I know this is less than an ideal data source as it has limited functionality. I have a search form on my website which allows users to define parameters and return results accordingly. The problem i have is a need to return these results in a random order each time. With SQLServer i know NEWID() would do the trick - used this many times before...
1
10499
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am trying to export to Excel using a command in an Access Form. RowID strFY AccountID CostElementWBS 1 2008 1 7 2 2008 1 7 I want to...
0
7667
MMcCarthy
by: MMcCarthy | last post by:
Rather than using the Access design view change the view to SQL. I am going to attempt to outline the general syntax used for SQL queries in Access. Angle brackets <> are used in place of some syntax elements you must supply. The description of these elements will be in the contained in the angle brackets. Square brackets are used to show which parts are optional. Basic SELECT query SELECT <field list> FROM <table/query name(s)>
0
6611
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9180
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.