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 ????
|
|
|
cvboucher
Posts: 191
|
Posted: 11/01/2012, 8:28 AM |
|
You are missing a parenthesis when retrieving your session variable.
Session("Userlogin")
Craig
|
|
|
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
|
|
|
pjcltd
Posts: 34
|
Posted: 11/01/2012, 8:36 AM |
|
this code i sgoin ginto the indexEvents.aspx.vb gile
|
|
|
pjcltd
Posts: 34
|
Posted: 11/01/2012, 8:36 AM |
|
this code i sgoin ginto the indexEvents.aspx.vb file
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|