creating a class

Results 1 to 2 of 2

Thread: creating a class

  1. #1
    Join Date
    Dec 1969

    Default creating a class

    Now that I have worked out how to parse and output an SQL command, I need to apply this to a class, so that I can call it within any application. However, my knowledge of OO programming is limited.<BR><BR>Can someone please advise me on how I put the following code (comments define start and end of class code) into a class and call it? I not sure about passing SQL command to the class.<BR><BR>----<BR><BR>con = New SqlConnection "Server=sqlserver;UID=me;PWD=pwd;Database=db")<BR> SQL = New SqlCommand("SELECT * FROM table WHERE id = @id", con)<BR>SQL.Parameters.Add("@id", 3)<BR>con.Open()<BR>datareader = SQL.ExecuteReader()<BR><BR><BR>&#039;// code to put in class -------------------<BR><BR>sqlcommand = SQL.commandtext.tostring<BR>for param=0 to SQL.Parameters.Count<BR>sqlcommand = replace(sqlcommand, SQL.Parameters(param).tostring, SQL.Parameters(param).value.tostring)<BR>param + = 1<BR>next<BR>response.write("<BR>sqlcommand: " & sqlcommand & "<BR>")<BR><BR>&#039;// end of code to put in class ------------<BR><BR><BR>Cheers<BR><BR>Dave <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: creating a class

    Download the iBuySpy portal and study it.. It will give you a general idea of how to create classes and compile them to the bin directory so you can use them in your program. It also makes use of static/shared methods. Which is probably what you want here... However I think it would defenitly benifit you to pick up a book on or c# and study oop. <BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts