jQuery UI Widgets Forums Grid ASP Classic and updaterow

This topic contains 9 replies, has 3 voices, and was last updated by  sergio57 7 years, 11 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • ASP Classic and updaterow #77916

    RedantJ
    Participant

    I feel like I’m close. What I want to do is POST to a new page, so that I can do a server SQL request:

    In my main page:

                    updaterow: function (rowid, newdata, commit) {
                        // synchronize with the server - send update command
                        // call commit with parameter true if the synchronization with the server is successful 
                        // and with parameter false if the synchronization failed.
    					
    					$.ajax({
    						dataType: 'json',
    						url: "update.asp",
    						data: newdata,
    						type: "POST",
    					});
    					
                        commit(true);
                    }

    In my update.asp page:

    <%dim strbarCode, strID
    
    strID = Request("ID")
    strbarCode = Request("barCode")
    
    sql =  "UPDATE tblHoldingBin SET Bar_Code = " & strbarCode & " WHERE OrderID = " & strID 
    set rs = conn.Execute(sql)%>

    Any ideas how I can make this work?

    ASP Classic and updaterow #77982

    Dimitar
    Participant

    Hello RedantJ,

    Unfortunately, we do not have any examples of integration between jQWidgets and ASP Classic. This does not mean they cannot be integrated, though.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    ASP Classic and updaterow #78128

    RedantJ
    Participant

    I’m thinking about a workaround of this problem using POST. If I’m able to POST the data that I need to update.asp, then it would just be a matter of requesting the data and I can continue onwards. I didn’t have any time this week to try it out this week on account of other priorities. I’ll post up when I succeed.

    ASP Classic and updaterow #78214

    RedantJ
    Participant

    Update: The Ajax POST method does work and will require some tinkering. I am dealing with an issue that is Microsoft Access / IIS related at the moment.

    ASP Classic and updaterow #78314

    RedantJ
    Participant

    After dealing with priorities, I’m back at work on this project.

    The IIS issue has been resolved. I’m still perfecting the code, the following works pretty good:

    Main page:

                   updaterow: function (rowid, newdata, commit) {
                        // synchronize with the server - send update command
                        // call commit with parameter true if the synchronization with the server is successful 
                        // and with parameter false if the synchronization failed.
    					$.ajax({
    						type:"POST",
    						url: "update.asp",
    						data: newdata,
    							success : function(d) {
    			                    commit(true);
    								alert("updated!");
    							}
    						});
                    }

    ….and on Update.asp:

    <%dim conn, strFoo1, strFoo2
    
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Mode = 3
    
    strFoo1 = Request.Form("Foo1")
    strFoo2 = Request.Form("Foo2")
    
    Conn.open "PROVIDER = MICROSOFT.JET.OLEDB.4.0;DATA SOURCE = C:\inetpub\wwwroot\HoldingBin\InvntryData.mdb"
    
    sql = "INSERT INTO tblTable (Foo1, Foo2) "
    sql = sql + "VALUES ('" & strFoo1 & "','" & strFoo2 & "')"
    
    conn.Execute(sql)	
    conn.close

    There is still a lot of tinkering to do. The ajax passes on the data to update.asp the way I expected it to do, the SQL statement needs work, and I’m pretty sure I will need to add an index column for this to work right. I’m a few steps closer to where I need to be.

    Thanks guys!

    ASP Classic and updaterow #78318

    RedantJ
    Participant

    It looks like what I will need to implement for ASP Classic will be similar to this. I will work on it for the rest of the week.

    (The wheels are turning, however slowly)

    ASP Classic and updaterow #78349

    RedantJ
    Participant

    And that’s done:

    When generating a blank row:

    	var generaterow = function (i) {
            var row = {};
    	row["idxUID"] = i;
    	row["foo1"] = "";
            row["foo2"] = "";
            return row;
    	}

    and here:

                // create new row.
                $("#addrowbutton").bind('click', function () {
    		var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;			
                    var datarow = generaterow(rowscount + 1);
    		var commit = $("#jqxgrid").jqxGrid('addrow', null, datarow);
                });

    …when using it inside of a function, for example addrow:

    	var data = "action=insert&" + $.param(rowdata);
    	$.ajax({
    		type: "GET",
    		url: "controller.asp",
    		data: data,
    		success : function(d) {
    			commit(true);
    			alert("added!");
    		}
    	});
            },

    This generates:

    http://localhost/blah/controller.asp?action=insert&idxUID=41&foo1=&foo2=

    Which makes controller.asp:

    <%dim conn, strIndex
    
    Set conn = Server.CreateObject("ADODB.Connection")
    
    strIndex = Request.QueryString("idxUID")
    strAction = Request.QueryString("action")
    
    Conn.open "PROVIDER = MICROSOFT.JET.OLEDB.4.0;DATA SOURCE = C:\blah\FooData.mdb"
    
    intComp = StrComp(strAction, "insert", vbTextCompare)
    
    if (intComp = 0) then
    	sql = "INSERT INTO tblTable (index) "
    	sql = sql + "VALUES (" & strIndex & ")"
    	conn.Execute(sql)	
    end if
    
    conn.close

    So now it works!

    ASP Classic and updaterow #78360

    Dimitar
    Participant

    Hi RedantJ,

    Thank you for your contribution to the forum.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    ASP Classic and updaterow #78390

    RedantJ
    Participant

    One more thing:

    As far as security goes, using GET in your ajax isn’t secure. I would use GET for testing purposes (to be sure the data is going from your grid to your controller). For a more secure page, use POST:

    (this is addrow)

    		var data = "action=insert&" + $.param(rowdata);
    		$.ajax({
    			type: "POST",
    			url: "controller.asp",
    			data: data,
    			success : function(data, status, xhr) 
    			{
    		                commit(true);
    			},
    			        error: function(jqXHR, textStatus, errorThrown)
    			{
    				commit(false);
    			}
    		});
                    },

    and in controller:

    strIndex = Request.Form("idxUID")
    strAction = Request.Form("action")

    And now it’s more secure.

    ASP Classic and updaterow #88098

    sergio57
    Participant

    RedantJ,
    I’m interested to integrate jqxgrid with classic asp, and I wanted to ask you if it was possible to have the scripts that you mention here, (update, delete, insert in the database with asp classic) in order to study them.
    If you think it’s possbile to do this I thank you in advance
    Good day and greetings

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.