Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Thursday, March 22, 2012

Hello,

the examples from MSDN like the following, don't run on my computer. A System.Data.SqlServer don't exist. No SQLCommand Type, no SQLContext.GetCommand Method and so on...

Ist there something wrong with my installation or how do i execute commands
inside a CLR SQL Server Trigger?

Regards,
Markus
Imports System
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlServer
Imports System.Data.SqlTypes
Imports System.Text.RegularExpressions

Public Class EmailTrigger

Public Shared Sub EmailAudit()
Dim triggContext As SqlTriggerContext = _
SqlContext.GetTriggerContext()
Dim userName As String
If triggContext.TriggerAction = TriggerAction.Insert Then
Dim sqlComm As SqlCommand = SqlContext.GetCommand()
Dim sqlP As SqlPipe = SqlContext.GetPipe()
sqlComm.CommandText = "SELECT Username from INSERTED"
Dim dataRecord As Object = sqlComm.ExecuteScalar
userName = dataRecord.ToString
If IsValidEMailAddress(userName) Then
sqlComm.CommandText = "INSERT Emails " & _
"VALUES ('" & userName & "')"
sqlP.Send(sqlComm.CommandText)
sqlP.Execute(sqlComm)
End If
End If
End Sub

Public Shared Function IsValidEMailAddress(ByVal email As String) _
As Boolean
Return Regex.IsMatch(email, _
"^([\w-]+\.)*?[\w-]+@.[\w-]+\.([\w-]+\.)*?[\w]+$")
End Function

End Class

It seems that something like this would work:

Dim pipe As SqlPipe = SqlContext.Pipe
Dim sqlcommand As New System.Data.SqlClient.SqlCommand

sqlcommand.CommandText = _
"Update Haushaltshilfe set Wochentag = 'Montag' where Wochentag = 'Dienstag'"
pipe.ExecuteAndSend(sqlcommand)

sqlcommand.CommandText = "Select * from inserted"
pipe.ExecuteAndSend(sqlcommand)

But how do i get the results?

Is it really so that the examples from msdn with System.Data.SQLServer don't work?|||The reason why it's not working for you is because the example you're trying is old, and they have now merged the old SqlServer provider for System.Data.SqlServer with the client side provider and created a new namespace: Microsoft.SqlServer.Server. In addition some of the methods on the SqlContext object have been replaced with properties.
Replace the Import System.Data.SqlServer with Import Microsoft.SqlServer.Server and do an extra import for System.Data.SqlClient. Then in the code where you say GetTriggerContext, use the propery TriggerContext instead. you also need to create a connection: Dim sqlConn as SqlConnection = new SqlConnection("Context Connection=true") and the open the connection. From the connection you can create the command: sqlConn.CreateCommand. Instead of GetPipe you use the Pipe property and finally you call ExecuteAndSend on the Pipe with your command as param.
Niels

|||Thank you very much Niels!
Are there web-pages where the latest changes in VS 2005 and SQL Server are documented?|||You can check Bob B's blog and mine. We're trying keep track of what's changing.

Sunday, March 11, 2012

.NET2 SMO Components

I am new in VS2005 and I start with sql2005 express. I plan to use SQL express 2005 manager.

When I tries to install this program the system asks for MS Framework,net2 SMO Components.

Where can I download these components?

Thank You

Best regards

?yvind

All of the information needed to install and run Management Studio Express is at http://www.microsoft.com/downloads/details.aspx?familyid=82AFBD59-57A4-455E-A2D6-1D4C98D40F6E&displaylang=en. If you still have questions after installing the required components, please let us know.

Peter

|||

The reason for original post was to get source from where the SMO components for .NET could be downloaded so that SQL Manager could be installed properly. And what you did is just posted the link from where SQL Manager could be downloaded.

|||At this point there isn't a separate SMO package. You have to install SS2005 express on the same computer you're installing SSMEE.|||See this link which contains a reference to the SMO redist : http://blogs.msdn.com/mwories/articles/smofaq.aspx|||I stand officially corrected.

.NET2 SMO Components

I am new in VS2005 and I start with sql2005 express. I plan to use SQL express 2005 manager.

When I tries to install this program the system asks for MS Framework,net2 SMO Components.

Where can I download these components?

Thank You

Best regards

?yvind

All of the information needed to install and run Management Studio Express is at http://www.microsoft.com/downloads/details.aspx?familyid=82AFBD59-57A4-455E-A2D6-1D4C98D40F6E&displaylang=en. If you still have questions after installing the required components, please let us know.

Peter

|||

The reason for original post was to get source from where the SMO components for .NET could be downloaded so that SQL Manager could be installed properly. And what you did is just posted the link from where SQL Manager could be downloaded.

|||At this point there isn't a separate SMO package. You have to install SS2005 express on the same computer you're installing SSMEE.|||See this link which contains a reference to the SMO redist : http://blogs.msdn.com/mwories/articles/smofaq.aspx|||I stand officially corrected.

Thursday, March 8, 2012

.net framework upgradation

hi,
I have installed vs.net 2002 (framework 1.0) in my system.
I have downloaded the framework 1.1 and sdk and installed both of them.
but the framework is not modified to 1.1 for vs.net. can u give a
solution to this problem.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Vijaya,
If you install 1.1 of the framework, VS 2002 will continue to use the 1.0
version. VS 2003 will use the 1.1 version. You can have both versions of
the framework on your PC as well as both version of VS (which I do) with no
problems. VS 2002 will use to older framework and VS 2003 will use the
newer.
J.R.
Largo SQL Tools
The Finest Collection of SQL Tools Available
http://www.largosqltools.com
"Vijaya sagar" <vjsaga@.yahoo.com> wrote in message
news:OyZZzTMjDHA.1672@.TK2MSFTNGP09.phx.gbl...
> hi,
> I have installed vs.net 2002 (framework 1.0) in my system.
> I have downloaded the framework 1.1 and sdk and installed both of them.
> but the framework is not modified to 1.1 for vs.net. can u give a
> solution to this problem.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Saturday, February 25, 2012

.mdf files

Hi,
I have 3 .mdf files on my system.
database.mdf (2 MB), database_1.mdf (450 MB), database_2.mdf (750 MB)
what does each file represent. If i have to take the backup of my
data(loga not required) then which file should i take.
Thanks
> what does each file represent. If i have to take the backup of my
> data(loga not required) then which file should i take.
Each file contains a portion of the database. You should backup the
database with BACKUP DATABASE rather than a file system backup. This will
backup all necessary data, including the transaction log, at consistent
state so that you can later RESTORE.
Hope this helps.
Dan Guzman
SQL Server MVP
"Gaurav" <gauravgoyal121@.gmail.com> wrote in message
news:1184326702.252930.117950@.n2g2000hse.googlegro ups.com...
> Hi,
> I have 3 .mdf files on my system.
> database.mdf (2 MB), database_1.mdf (450 MB), database_2.mdf (750 MB)
> what does each file represent. If i have to take the backup of my
> data(loga not required) then which file should i take.
> Thanks
>

.mdf files

Hi,
I have 3 .mdf files on my system.
database.mdf (2 MB), database_1.mdf (450 MB), database_2.mdf (750 MB)
what does each file represent. If i have to take the backup of my
data(loga not required) then which file should i take.
Thanks> what does each file represent. If i have to take the backup of my
> data(loga not required) then which file should i take.
Each file contains a portion of the database. You should backup the
database with BACKUP DATABASE rather than a file system backup. This will
backup all necessary data, including the transaction log, at consistent
state so that you can later RESTORE.
Hope this helps.
Dan Guzman
SQL Server MVP
"Gaurav" <gauravgoyal121@.gmail.com> wrote in message
news:1184326702.252930.117950@.n2g2000hse.googlegroups.com...
> Hi,
> I have 3 .mdf files on my system.
> database.mdf (2 MB), database_1.mdf (450 MB), database_2.mdf (750 MB)
> what does each file represent. If i have to take the backup of my
> data(loga not required) then which file should i take.
> Thanks
>

.mdf files

Hi,
I have 3 .mdf files on my system.
database.mdf (2 MB), database_1.mdf (450 MB), database_2.mdf (750 MB)
what does each file represent. If i have to take the backup of my
data(loga not required) then which file should i take.
Thanks> what does each file represent. If i have to take the backup of my
> data(loga not required) then which file should i take.
Each file contains a portion of the database. You should backup the
database with BACKUP DATABASE rather than a file system backup. This will
backup all necessary data, including the transaction log, at consistent
state so that you can later RESTORE.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Gaurav" <gauravgoyal121@.gmail.com> wrote in message
news:1184326702.252930.117950@.n2g2000hse.googlegroups.com...
> Hi,
> I have 3 .mdf files on my system.
> database.mdf (2 MB), database_1.mdf (450 MB), database_2.mdf (750 MB)
> what does each file represent. If i have to take the backup of my
> data(loga not required) then which file should i take.
> Thanks
>

Sunday, February 19, 2012

...Contains more than the maximum number of prefixes. The maximum is 3.

SQL Server 2000 8.00.760 (SP3)

I've been working on a test system and the following UDF worked fine.
It runs in the "current" database, and references another database on
the same server called 127-SuperQuote.

CREATE FUNCTION fnGetFormattedAddress(@.WorkID int)

RETURNS varchar(130)

AS

BEGIN

DECLARE

@.Address1 As varchar(50)
@.ReturnAddress As varchar(130)

SELECT
@.Address1 = [127-SuperQuote].dbo.tblCompany.Address1
FROM
[Work] INNER JOIN
[127-SuperQuote].dbo.tblCompany ON [Work].ClientID =
[127-SuperQuote].dbo.tblCompany.CompanyID
WHERE
[Work].WorkID = @.WorkID

IF @.Address1 IS NOT NULL
SET @.ReturnAddress = @.ReturnAddress + @.Address1 + CHAR(13)+ CHAR(10)

RETURN @.ReturnAddress

END

So now the system has gone live and it turns out that the live
"SuperQuote" database is on a different server.

I've linked the server and changed the function as below, but I get an
error both in QA and when checking Syntax in the UDF builder:

The number name 'Zen.SuperQuote.dbo.tblCompany' contains more than the
maximum number of prefixes. The maximum is 3.

CREATE FUNCTION fnGetFormattedAddress(@.WorkID int)

RETURNS varchar(130)

AS

BEGIN

DECLARE

@.Address1 As varchar(50)
@.ReturnAddress As varchar(130)

SELECT
@.Address1 = Zen.SuperQuote.dbo.tblCompany.Address1
FROM
[Work] INNER JOIN
Zen.SuperQuote.dbo.tblCompany ON [Work].ClientID =
Zen.SuperQuote.dbo.tblCompany.CompanyID
WHERE
[Work].WorkID = @.WorkID

IF @.Address1 IS NOT NULL
SET @.ReturnAddress = @.ReturnAddress + @.Address1 + CHAR(13)+ CHAR(10)

RETURN @.ReturnAddress

END

How can I get round this? By the way, I've rather simplified the
function to ease readability. Also, I haven't posted any DDL because I
don't think that's the problem!

Thanks

Edwardteddysnips@.hotmail.com wrote:
[...]

Alias, you dolt!

Sorry if I've wasted anyone's time.

Edward|||Thanks for wasting even more of everyone's time by not indicating your mistake and having this useless thread replicated to dozens of other forums!

From http://www.developmentnow.com/g/95_...ximum-is-3-.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

... or changing system table

if ALTER myTable ALTER COLUMN id ...
to remove IDENTITY from a column is not possible (what i fear), can i
change this in a system table?
HelmutHelmut
Why ? It is strongly not recommended to alter system tables.
Why don't you want to move the data to the new column and then drop the old
one?
"Helmut Woess" <user22@.inode.at> wrote in message
news:sdwgal2frk9n$.gvo98pu5gu99$.dlg@.40tude.net...
> if ALTER myTable ALTER COLUMN id ...
> to remove IDENTITY from a column is not possible (what i fear), can i
> change this in a system table?
> Helmut|||Am Sun, 30 Apr 2006 14:50:06 +0300 schrieb Uri Dimant:

> Why ? It is strongly not recommended to alter system tables.
> Why don't you want to move the data to the new column and then drop the o
ld
> one?
Okay, here the whole story: i have a special stored proc called by the
trigger, and in this stored proc i need the data from temp tables deleted
and inserted.
For this i did a "insert into #ins select * from inserted" (and the same
for deleted) and used the data in #ins/#del in the stored proc. This is
working, but it needs too much time and ressource, to create and drop this
temp tables in every call of the trigger.
So i thougt, i create a global ##ins/##del at first call of the trigger:
if object_id('tempdb..##table1_ins') is Null -- create table
select * into ##table1_ins from inserted where 1 = 2
...
and then there is no need to create and drop the temp tables in each
execution of the trigger.
But if i do this, i cannot longer do a "insert into #ins select * from
inserted" i must do a "select * into ##table1_ins from inserted".
And my problem is now, that every record has as first field a field named
id and this is an identity field. So a "select * into ##table1_ins from
inserted" is not working because of the identity field.
But if i can change this and remove the identity property it should work.
It doesn't work if i drop this column and add it again, because it is added
at the end of the record and not at the beginning, so a "select * into..."
would not longer be possible.
And i don't want to set identity_insert ON and OFF and use a field list for
the select statement, because i have more than 120 tables where i need this
solution and some of the records have nearly 200 fields, so i need a
universal solution to bring the data from temp tables inserted and deleted
into the stored proc. In this misery i would even change system tables if
this helps.
Maybe you have a better idea how to do this?
thanks, Helmut|||Helmut
As I see you are using SQL Server 2000, am I right? In SQL Server 2005 you
have a new functino ROW_NUMBER() which provides you a sequential number of a
row within a partition of a result set.
Well, I don't know your business requirements , however I'd redesign an
approach of calling stored procedures within a trigger and morepver creating
a temporaring tables.
Now, can you create a surrogate key in your tables that you will see in
'deleted' and 'inserted' virtual tables , so there is no need to add am
identity property at all, or if it does not help please post the code and
additional info about what are you trying to achive.
"Helmut Woess" <user22@.inode.at> wrote in message
news:ket7d7xavej9$.1niowodavl99.dlg@.40tude.net...
> Am Sun, 30 Apr 2006 14:50:06 +0300 schrieb Uri Dimant:
>
> Okay, here the whole story: i have a special stored proc called by the
> trigger, and in this stored proc i need the data from temp tables deleted
> and inserted.
> For this i did a "insert into #ins select * from inserted" (and the same
> for deleted) and used the data in #ins/#del in the stored proc. This is
> working, but it needs too much time and ressource, to create and drop this
> temp tables in every call of the trigger.
> So i thougt, i create a global ##ins/##del at first call of the trigger:
> if object_id('tempdb..##table1_ins') is Null -- create table
> select * into ##table1_ins from inserted where 1 = 2
> ...
> and then there is no need to create and drop the temp tables in each
> execution of the trigger.
> But if i do this, i cannot longer do a "insert into #ins select * from
> inserted" i must do a "select * into ##table1_ins from inserted".
> And my problem is now, that every record has as first field a field named
> id and this is an identity field. So a "select * into ##table1_ins from
> inserted" is not working because of the identity field.
> But if i can change this and remove the identity property it should work.
> It doesn't work if i drop this column and add it again, because it is
> added
> at the end of the record and not at the beginning, so a "select * into..."
> would not longer be possible.
> And i don't want to set identity_insert ON and OFF and use a field list
> for
> the select statement, because i have more than 120 tables where i need
> this
> solution and some of the records have nearly 200 fields, so i need a
> universal solution to bring the data from temp tables inserted and deleted
> into the stored proc. In this misery i would even change system tables if
> this helps.
> Maybe you have a better idea how to do this?
> thanks, Helmut|||Am Sun, 30 Apr 2006 16:08:39 +0300 schrieb Uri Dimant:

> Helmut
> As I see you are using SQL Server 2000, am I right? In SQL Server 2005 you
> have a new functino ROW_NUMBER() which provides you a sequential number of
a
> row within a partition of a result set.
> Well, I don't know your business requirements , however I'd redesign an
> approach of calling stored procedures within a trigger and morepver creati
ng
> a temporaring tables.
> Now, can you create a surrogate key in your tables that you will see in
> 'deleted' and 'inserted' virtual tables , so there is no need to add am
> identity property at all, or if it does not help please post the code and
> additional info about what are you trying to achive.
>
Uri,
you are right, it is SQL2000 (but we want to change to 2005 the next
ws).
What i have to solve: log all inserts/changes/deletes
Because i have to do this for a lot of tables i need an universal solution.
For this i use a trigger, the trigger only puts data from inserted/deleted
into temp tables and calls a stored proc which makes the rest.
This is because if something changes, i have only the stored proc to change
and not hundred of triggers.
The business is now, how can i bring the data from inserted/deleted as fast
as possible in an universal way into this stored proc.
And i am figthing with the fact that that every of this tables has this
identity field as first field. I don't want to add identity attribute, i
want to remove it!
Because of automation, temp table ##tbl is created as
"select * into ##tmp from inserted where 1 = 2"
which creates an empty copy of inserted, unfortunately with identity
attribute too.
Then i want to copy data from inserted into #tbl with
"insert into ##tbl select * from inserted"
which is not possible as long as ##tbl has this identity attribute too.
If you tell me that it is not possible in a simple way in SQL2000, then i
could stop this work for SQL2000 and search for a solution in SQL2005.
What do you think, will it be easier in SQL2005 (maybe using CLR)?
sorry, i cannot post complete code (company ownership, you know)
thanks, Helmut|||Helmut Woess (user22@.inode.at) writes:
> Okay, here the whole story: i have a special stored proc called by the
> trigger, and in this stored proc i need the data from temp tables deleted
> and inserted.
> For this i did a "insert into #ins select * from inserted" (and the same
> for deleted) and used the data in #ins/#del in the stored proc. This is
> working, but it needs too much time and ressource, to create and drop this
> temp tables in every call of the trigger.
> So i thougt, i create a global ##ins/##del at first call of the trigger:
> if object_id('tempdb..##table1_ins') is Null -- create table
> select * into ##table1_ins from inserted where 1 = 2
> ...
Use a permanent table, keyed by spid instead.
Read more about it here:
http://www.sommarskog.se/share_data.html#prockeyed
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Monday, February 13, 2012

* SQL 2005 Backup fails *

Hi,
I get this error when I try to backup my database:
System.Data.SqlClient.SqlError: The backup of the file or filegroup
"sysft_search" is not permitted because it is not online. BACKUP can be
performed by using the FILEGROUP or FILE clauses to restrict the
selection to include only online data. (Microsoft.SqlServer.Smo)
Any suggestions?
Thanks
ArasIt seems like that filegroup is OFFLINE
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<ageylani@.gmail.com> wrote in message news:1132031733.247332.327150@.g43g2000cwa.googlegroups.com...
> Hi,
> I get this error when I try to backup my database:
> System.Data.SqlClient.SqlError: The backup of the file or filegroup
> "sysft_search" is not permitted because it is not online. BACKUP can be
> performed by using the FILEGROUP or FILE clauses to restrict the
> selection to include only online data. (Microsoft.SqlServer.Smo)
> Any suggestions?
> Thanks
> Aras
>|||here are some sys queries if it helps you
USE inkeo
GO
SELECT * FROM sysfilegroups
SELECT * FROM sysfiles
groupid allocpolicy status groupname
-- -- -- --
1 0 16 PRIMARY
(1 row(s) affected)
fileid groupid size maxsize growth status perf name filename
-- -- -- -- -- -- -- --
--
1 1 2208 -1 10 1048578 0 cdgstore_Data D:\inkeo_Data.mdf
2 0 128 -1 10 1048642 0 cdgstore_Log D:\inkeo_Log.ldf
(2 row(s) affected)
SELECT @.@.VERSION shows this
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005
00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Enterprise
Edition on Windows NT 5.0 (Build 2195: Service Pack 4)|||What about
select name, state_desc from sys.database_files
Ben Nevarez, MCDBA, OCP
Database Administrator
"ageylani@.gmail.com" wrote:
> here are some sys queries if it helps you
> USE inkeo
> GO
> SELECT * FROM sysfilegroups
> SELECT * FROM sysfiles
> groupid allocpolicy status groupname
> -- -- -- --
> 1 0 16 PRIMARY
> (1 row(s) affected)
> fileid groupid size maxsize growth status perf name filename
> -- -- -- -- -- -- -- --
> --
> 1 1 2208 -1 10 1048578 0 cdgstore_Data D:\inkeo_Data.mdf
> 2 0 128 -1 10 1048642 0 cdgstore_Log D:\inkeo_Log.ldf
> (2 row(s) affected)
> SELECT @.@.VERSION shows this
> Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005
> 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Enterprise
> Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>|||cdgstore_Data ONLINE
cdgstore_Log ONLINE
sysft_search OFFLINE
Interesting! I think sysft_search must have came from SQL 2000. I saw
same failures in all otherdatabases imported from a backup from SQL
2000 ! Anyways, now what you suggest?
Regards,
Aras|||My guess is that this is the full-text index catalog. I'm not FT person, but my guess is that this
doesn't come online until you repopulate (or something) the catalog.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<ageylani@.gmail.com> wrote in message news:1132095781.722737.151390@.z14g2000cwz.googlegroups.com...
> cdgstore_Data ONLINE
> cdgstore_Log ONLINE
> sysft_search OFFLINE
> Interesting! I think sysft_search must have came from SQL 2000. I saw
> same failures in all otherdatabases imported from a backup from SQL
> 2000 ! Anyways, now what you suggest?
> Regards,
> Aras
>|||I just arrived at a solution through experimentation. Use at your own risk!
sp_help_fulltext_catalogs
... Gets you the catalog name. In my case it was 'Full Text'
sp_fulltext_catalog @.ftcat = 'Full Text', @.action='Drop'
... Command(s) completed successfully.
backup database DW30305DEMO to DISK = 'C:\DW30305\DW30305.dmp'

Saturday, February 11, 2012

(system) Variable that holds the record count of a result set?

Hello
is there a variable that is available to me that contains the number
of rows contained in a dataset return from a database call?

have a class that runs a stored proc and returns a dataset/resultset
looking to simply assign an integer this value if it is possible

i'm using (learning) vb.net and sql server

thanks in advance

If you are using a dataset, you can get the number of rows with this syntax:

DataSet1.tables(0).rows.count (assuming your Dataset returns only 1 resultset. If you have more than 1, just replace the zero with whatever index you need.)

If you use a DataReader, which tends to be faster, this property is not available, unfortunately.|||

hello. thank you for the reply. that is exactly what i was looking for (DataSet1.tables(0).rows.count). a question about how to reference this from the codebehind...

i have a codebehind that Dims a class, the class returns the dataset, in the codebehind i have a line likeDropDownList1.DataSource = myClass.function1(parm1) to populate the dropdown with the data from the dataset. i get how i could reference this value in the class code, but how would i reference it in the codebehind? is there a way. would i have to do it in the class function and store it in a session variable or something? would be like to reference it directly in the codebehind as that is where i would be using the value.

thanks again.

|||

i believe i have figured my question out (yup, i'm new), but if you have any comments i'd appreciate it

instead of directly coding the line as DDL1.DataSource = myClass.function1(parm1)

i modified the code to have...

Dim ds as dataSet = myClass.function1(parm1)
Dim dsCnt as integer = ds.Tables(0).Rows.Count()
DDL1.DataSource = ds

this seemed to get me what i was after. if there is a more efficient or elegant way to do this, i'm all earsSmile [:)]

|||The way you've done it is fine. An alternative is to create a property of type dataset in your class, then fill that property in your function. The code behind could then reference your property.

Public Class myClass

Private mMyDataset as dataset

Public Sub New()
MyBase.new()
End Sub

Property MyDataset() As dataset
Get
Return mMyDataset
End Get
Set(ByVal Value As dataset)
mMyDataset = Value
End Set
End Property

Public Sub function1(param) 'can change to a sub since you are filling a property rather than using a return value
myDataset = Database call goes here
End Sub

From your code behind:

dim objClass as new myClass()

with objClass
.function1(param)
DDL1.datasource = .myDataset
DDL1.databind
end with