CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP.NET - InMotion Framework

 (SOLVED) custom Sql code

Print topic Send  topic

Author Message
pjcltd

Posts: 34
Posted: 11/01/2012, 6:34 AM

Hi
i am trying to get a custom sql code running on my index page

i need tobe able to see what user has been on a page for tracking
i can gt the username / userid from session's
but when i try and use custome code i get probelms

Dim Request As HttpRequest = HttpContext.Current.Request
Dim NewDao As Settings.Connection2
Dim ddatenow
ddatenow=DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss")
Dim Sql As String ="INSERT INTO tracking (uname ,udate,upage) VALUES ('" & Session"Userlogin") & "','" & ddatenow & "','Open Filters Page')"
'NewDao.RunSql(Sql)

can any one help ????
View profile  Send private message
cvboucher

Posts: 191
Posted: 11/01/2012, 8:28 AM

You are missing a parenthesis when retrieving your session variable.

Session("Userlogin")

Craig
View profile  Send private message
pjcltd

Posts: 34
Posted: 11/01/2012, 8:34 AM

ok i did spot that
but now i am getting this

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'Settings.Connection2' is not defined.

Source Error:



Line 131:
Line 132:Dim Request As HttpRequest = HttpContext.Current.Request
Line 133:Dim NewDao As Settings.Connection2
Line 134:Dim ddatenow
Line 135:ddatenow=DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss")


Source File: D:\Ops-Portal\operations\filters\indexEvents.aspx.vb Line: 133
View profile  Send private message
pjcltd

Posts: 34
Posted: 11/01/2012, 8:36 AM

this code i sgoin ginto the indexEvents.aspx.vb gile
View profile  Send private message
pjcltd

Posts: 34
Posted: 11/01/2012, 8:36 AM

this code i sgoin ginto the indexEvents.aspx.vb file
View profile  Send private message
cvboucher

Posts: 191
Posted: 11/02/2012, 9:07 AM

Here's a link to some sample code on how to execute custom SQL.

http://code.google.com/p/inmotion-framework/wiki/ExecuteCustomSQL
http://code.google.com/p/inmotion-framework/wiki/HowTo

HTH,
Craig
View profile  Send private message
pjcltd

Posts: 34
Posted: 11/16/2012, 5:17 AM

Quote cvboucher:
Hi Craig
Sorry it took so long to get back to you
i have been away

the links worked fine for me and this has solved my custom code issue
thanks
Paul
View profile  Send private message
pjcltd

Posts: 34
Posted: 11/16/2012, 5:21 AM

This what my custom SQL looks like



'TextArea Filter_name Event Before Show. Action Save Control Value @26-BC5907EE
dim f_name
f_name = ops_filters.GetControl(Of InMotion.Web.Controls.MTTextBox)("Filter_name").Value
Dim conn As Connection
conn = DataUtility.GetConnectionObject("InMotion:Connection1")
Dim insert As DataCommand
Dim ddatenow
ddatenow=DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")
insert = conn.CreateCommand()
insert.MTCommandType = MTCommandType.Table
insert.CommandText = "INSERT INTO operations.dbo.tracking (uname ,udate,upage) VALUES ('" & Session("Userlogin") & "','" & ddatenow & "','Edited Filter "& F_name & "' )"
insert.ExecuteNonQuery()

'End TextArea Filter_name Event Before Show. Action Save Control Value


I have put this in edit_filterEvents.aspx.vb


Thanks
Paul

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.