S
shapper
Hello,
I have the tables content and content_localized in a Microsoft Access
database.
I created a Query in my Microsoft Access database named
"content_SELECT":
SELECT content_localized.content_html
FROM content INNER JOIN content_localized ON content.content_id =
content_localized.content_id
WHERE (((content.content_page)=[@Page]) AND
((content.content_name)=[@Name]) AND
((content_localized.content_culture)=[@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_localized.content_html.
Maybe is the problem is with my query and the use of @, ?, ...
My function code is as follows:
---------------------------------------------------------------------------------
Public Function Load()
' Set Connection
Dim connectionString As String =
ConfigurationManager.ConnectionStrings(_ConnectionString).ConnectionString
Dim connection As New
System.Data.OleDb.OleDbConnection(connectionString)
' Set Command
Dim command As New System.Data.OleDb.OleDbCommand
With command
.CommandText = "EXECUTE content_SELECT"
.Connection = connection
.CommandType = CommandType.Text
End With
' Add Parameters
With command.Parameters
.Add(New OleDb.OleDbParameter("[@Culture]", "pt-PT"))
.Add(New OleDb.OleDbParameter("[@Page]", "Default.aspx"))
.Add(New OleDb.OleDbParameter("[@Name]", "Newsletter"))
End With
' Execute the Command
connection.Open()
Dim contentHtml As OleDb.OleDbDataReader = command.ExecuteReader
If contentHtml.Read Then
Return contentHtml.Item("content_html").ToString()
Else
Return "Something is Wrong" ***
End If
contentHtml.Close()
connection.Close()
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
I have the tables content and content_localized in a Microsoft Access
database.
I created a Query in my Microsoft Access database named
"content_SELECT":
SELECT content_localized.content_html
FROM content INNER JOIN content_localized ON content.content_id =
content_localized.content_id
WHERE (((content.content_page)=[@Page]) AND
((content.content_name)=[@Name]) AND
((content_localized.content_culture)=[@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_localized.content_html.
Maybe is the problem is with my query and the use of @, ?, ...
My function code is as follows:
---------------------------------------------------------------------------------
Public Function Load()
' Set Connection
Dim connectionString As String =
ConfigurationManager.ConnectionStrings(_ConnectionString).ConnectionString
Dim connection As New
System.Data.OleDb.OleDbConnection(connectionString)
' Set Command
Dim command As New System.Data.OleDb.OleDbCommand
With command
.CommandText = "EXECUTE content_SELECT"
.Connection = connection
.CommandType = CommandType.Text
End With
' Add Parameters
With command.Parameters
.Add(New OleDb.OleDbParameter("[@Culture]", "pt-PT"))
.Add(New OleDb.OleDbParameter("[@Page]", "Default.aspx"))
.Add(New OleDb.OleDbParameter("[@Name]", "Newsletter"))
End With
' Execute the Command
connection.Open()
Dim contentHtml As OleDb.OleDbDataReader = command.ExecuteReader
If contentHtml.Read Then
Return contentHtml.Item("content_html").ToString()
Else
Return "Something is Wrong" ***
End If
contentHtml.Close()
connection.Close()
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