Code Monkey home page Code Monkey logo

cuteaspframework's People

Watchers

 avatar

cuteaspframework's Issues

Add data type handling in /include/library/db.asp, with source code

Function Update(Table,Params,Where)
        Dim sqlCmd, parameteres, oParams
        Dim iName
        sqlCmd = "Set nocount on" & vbCrlf
        sqlCmd = sqlCmd & "Update "&Table&" set "
        parameteres = " "
        set objRec=ExecuteRecordSet("select top 0 * from " & table 
, null)
        Set oParams = Server.CreateObject("Scripting.Dictionary")
        If Not IsNull(params) Then
            For Each iName in params
                If InStr(iName,"#") > 0 Then
                    params.Key(iName) = 
Replace(iName,"#","")
                    iName = Replace(iName,"#","")
                    sqlCmd = sqlCmd & iName & "=" & 
iName & " + @" & iName & ","
                Else
                    sqlCmd = sqlCmd & iName & "=@" & 
iName & ","
                End If

                select case objRec(replace(iName, "@", 
"")).type
                case 3, 20, 17,2
                dtype = " int "
                case 4, 5, 6, 14, 131
                dtype = " decimal(20,15) "
                case 135
                dtype = " datetime "
                case 204, 128,205
                dtype = " binary "
                case 11

                dtype = " bit "
                case 129, 130, 202, 200, 201, 203
                dtype = " varchar(8000) "
                case else
                dtype = " varchar(8000) "
                end select

                parameteres = parameteres & "@" & iName & 
dtype & ","
            Next
        End If
        sqlCmd = Left(sqlCmd,Len(sqlCmd)-1)
        If Trim(Where) <> "" Then sqlCmd=sqlCmd&" Where "&Where&""
        sqlCmd = sqlCmd & vbCrlf & "select CAST(IsNull(@@ROWCOUNT,-
100) as int)"
        parameteres = Left(parameteres,Len(parameteres)-1)
        oParams.Add "@stmt",sqlCmd
        oParams.Add "@parameters",parameteres
        If Not IsNull(Params) Then
            For Each iName in Params
                oParams.Add "@"&iName,Params(iName)&""
            Next
        End If
        Update = Me.ExecuteScalar("sp_executesql",oParams)
        Set oParams = Nothing
    End Function

Original issue reported on code.google.com by [email protected] on 21 Oct 2009 at 10:55

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.