Home > SQL Development > ASP and COM

ASP and COM



<i><b>Originally posted by : Rick M (rick.mcdonnell@eds.com)</b></i><br />Hi,<br /><br />Can someone share a VB COM class that is used with ASP and SQL?<br /><br />Thanks,<br />Rick

    
Guest


<i><b>Originally posted by : notimportant (jhunt@alagreen.com)</b></i><br /><br />'this is used to call a single row<br />'from a SQL7 - 2000 table<br />'I call this <tablename.load><br />'this table is named criteria<br />'mvarcriteriaid is the unique id for the row<br />'imvarevalid is the key<br />'_______________<br />Private mvarcriteriaid As Integer 'local copy<br />Private mvarevalid As Integer 'local copy<br />Private mvarjob_title As String 'local copy<br />Private mvarjob_summary As String 'local copy<br /><br />Public Property Let criteriaid(ByVal vData As Integer)<br /> 'used when assigning a value to the property, on the left side of an assignment.<br /> 'Syntax: X.criteriaid = 5<br /> mvarcriteriaid = vData<br />End Property<br />Public Property Get criteriaid() As Integer<br />'used when retrieving value of a property, on the right side of an assignment.<br />'Syntax: Debug.Print X.criteriaid<br /> criteriaid = mvarcriteriaid<br />End Property<br />Public Property Let evalid(ByVal vData As Integer)<br /> 'used when assigning a value to the property, on the left side of an assignment.<br /> 'Syntax: X.evalid = 5<br /> mvarevalid = vData<br />End Property<br />Public Property Get evalid() As Integer<br />'used when retrieving value of a property, on the right side of an assignment.<br />'Syntax: Debug.Print X.evalid<br /> evalid = mvarevalid<br />End Property<br />Public Property Let job_title(ByVal vData As String)<br /> 'used when assigning a value to the property, on the left side of an assignment.<br /> 'Syntax: X.job_title = 5<br /> mvarjob_title = vData<br />End Property<br />Public Property Get job_title() As String<br />'used when retrieving value of a property, on the right side of an assignment.<br />'Syntax: Debug.Print X.job_title<br /> job_title = mvarjob_title<br />End Property<br />Public Property Let job_summary(ByVal vData As String)<br /> 'used when assigning a value to the property, on the left side of an assignment.<br /> 'Syntax: X.job_summary = 5<br /> mvarjob_summary = vData<br />End Property<br />Public Property Get job_summary() As String<br />'used when retrieving value of a property, on the right side of an assignment.<br />'Syntax: Debug.Print X.job_summary<br /> job_summary = mvarjob_summary<br />End Property<br />'_________________________________<br />'I call this <tablename.actions><br />'both of there live in the same .dll<br /><br />Function Selectcriteria(intEvalId As Integer) As Object<br />Dim objCmd As New ADODB.Command<br />Dim objRs As New ADODB.Recordset<br />Dim objcriteria As New load<br />' Open a connection<br />Dim objConn As New ADODB.Connection<br />With objConn<br />.Properties("Data Source") = "odbc source"<br />.Properties("User Id") = "user id"<br />.Properties("Password") = "password"<br />.Open<br />End With<br />'I am using a stored procedire but you could use a select statment<br />With objCmd<br />.ActiveConnection = objConn<br />.CommandType = adCmdStoredProc<br />.CommandText = "usp_SELECTcriteria"<br />.Parameters("@intcriteriaid") = intEvalId<br />End With<br /><br />Set objRs = objCmd.Execute<br />If objRs.EOF Or objRs.BOF Then<br />'error code here.....<br />Else<br /> With objcriteria<br /> .criteriaid = objRs("criteriaid").Value<br /> .evalid = objRs("evalid").Value<br /> .job_title = objRs("job_title").Value<br /> .job_summary = objRs("job_summary").Value<br /> End With<br />End If<br />Set Selectcriteria = objcriteria<br />End Function<br /><br />'______________________________<br />'ASP CALL<br />dim objCriteriaFlds,objCriteria<br />set objCriteriaFlds = createobject("criteria.load")<br />set objCriteria = createobject("criteria.actions")<br />set objCriteriaFlds = objCriteria.Selectcriteria(CInt(intUniqueRowId))<br /><br />_________________<br /><HTML><br /><BODY><br /><input name="job_title" value="<%= objCriteriaFlds.job_title %>"></input><br /><input name="job_title" value="<%= objCriteriaFlds.job_summary %>"></input><br /></BODY><br /></HTML><br /><br />Hope this helps<br />Have fun!

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved