Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2005, 11:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing dataset obj (in .dll) from an aspx page

Hi!
  First of all I like to thank for the support I got from this forum when I learnt ASP. I wish to get the same for .NET. I am a ASP.NET beginner. I am writing a small webbased application for my personal use. I want to access a dataset object (in dll) from an asp page. Here is the source code :

========
add.aspx
========


<%@ Page Language="VB" Debug="True" %>
<%@ import Namespace="eMarker" %>
<script runat="server">
    sub page_load (source as object, e as eventargs)

      Dim objdll as new emarker.App()
      Dim result as String

      if session("userid")="" then
        response.redirect("default.aspx")
      end if

      if lcase(request.Querystring("action"))="category" then
        result=objdll.catList("select * from category order by catname","category")

================================================== ================
I want to access the objds dataset object from here to bind it to datalist control.
================================================== ================


      end if

    end sub

</script>
<html>
<head>
</head>
<body>
  '''''''''''''''' datalist control code goes here ''''''''''''
</body>
</html>



==========
eMarker.vb (complied as dll)
==========


Option explicit

Imports System
Imports System.Data
Imports System.Data.sqlclient

Namespace eMarker
  public Class App

    ' ODBC Configuration
    private function DBSettings() as String
      dim DSN as String
      DSN="Server=localhost; Database=eMarker; uid=x; pwd=x;"
      return(DSN)
    End function

    'Query to list the categories
    public function CatList(SQL as string,tblname as string) as string
        Dim objConn as new sqlConnection(DBSettings())
        Dim objCmd as new sqlDataAdapter(SQL,objConn)
        Dim objds as new dataset
    Dim i as integer
    Dim output as string

    objCmd.fill(objds,tblname)

================================================== ==================
         I want to access the above dataset object from the add.aspx page so that I can display the selected records in the datalist control.
================================================== ==================


      End function
  End Class
End Namespace

''''' End of code '''''

Any help please ??

Arul Kumar.PA
__________________
Arul Kumar.PA
 
Old August 8th, 2005, 09:04 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

First off, eMarker.App.CatList() needs to return something, is this case the dataset you are filling (objds).

Then when you call that method you can bind the returned result to the datalist on the page.

-Peter
 
Old August 8th, 2005, 10:29 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 First off, eMarker.App.CatList() needs to return something, is this case the dataset you are filling (objds).

Then when you call that method you can bind the returned result to the datalist on the page.

-Peter
Planoie thank you for your reply but it didn't work. I returned objds object from emarker.app.catlist() but it throwed an error:

value of type 'System.Data.Dataset' cannot be converted to string

I then tried to compile dll after removing the datatype string from the following line

public function CatList(SQL as string,tblname as string) as string

changed to :

public function CatList(SQL as string,tblname as string)

The dll compiled successfully but I was not able to use the object objds from my aspx page. It throwed an error mentioning that:

BC30451: Name 'objds' is not declared

What to do ? Help, please.

Arul Kumar.PA





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem accessing .dll methods,interfaces.. stevenzambas C# 0 May 8th, 2007 10:30 AM
Accessing Dataset Properties kjward BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 November 16th, 2006 01:18 PM
Problem accessing a .dll component in asp.net page ng4123 ASP.NET 1.0 and 1.1 Basics 5 May 10th, 2006 07:31 AM
Accessing DLL using Java Script sooraj_iyer Javascript 5 September 17th, 2004 04:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.