Hi,
I was wondering if there were a way to
Export event logs directly to SQL. Does anyone know if this is possible
using VBscript or any of the Resource Kit tools?
Thanks.This is easily done using .NET and the eventlog classes that exists in there. Requires a bit of .NET
coding, though, using your favorite language. I don't have my code here, so I don't recall the class
names etc, but reading the eventlog only requires a few lines of code.
You can do this using WMI as well, but as I'm not familiar with WMI programming I decoded to use the
.NET classes instead.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"-" <-@.-.com> wrote in message news:edlVk8r6DHA.2764@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I was wondering if there were a way to
> Export event logs directly to SQL. Does anyone know if this is possible
> using VBscript or any of the Resource Kit tools?
>
> Thanks.
>|||LOGPARSER from the IIS6 resource kit does exactly this
http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&DisplayLang=en
regards
paul
"-" <-@.-.com> wrote in message news:edlVk8r6DHA.2764@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I was wondering if there were a way to
> Export event logs directly to SQL. Does anyone know if this is possible
> using VBscript or any of the Resource Kit tools?
>
> Thanks.
>
Showing posts with label vbscript. Show all posts
Showing posts with label vbscript. Show all posts
Thursday, March 29, 2012
Export event logs directly to SQL?
Hi,
I was wondering if there were a way to
Export event logs directly to SQL. Does anyone know if this is possible
using VBscript or any of the Resource Kit tools?
Thanks.This is easily done using .NET and the eventlog classes that exists in there
. Requires a bit of .NET
coding, though, using your favorite language. I don't have my code here, so
I don't recall the class
names etc, but reading the eventlog only requires a few lines of code.
You can do this using WMI as well, but as I'm not familiar with WMI programm
ing I decoded to use the
.NET classes instead.
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"-" <-@.-.com> wrote in message news:edlVk8r6DHA.2764@.TK2MSFTNGP09.phx.gbl...
http://www.microsoft.com/downloads/...&DisplayLang=en
regards
paul
"-" <-@.-.com> wrote in message news:edlVk8r6DHA.2764@.TK2MSFTNGP09.phx.gbl...
I was wondering if there were a way to
Export event logs directly to SQL. Does anyone know if this is possible
using VBscript or any of the Resource Kit tools?
Thanks.This is easily done using .NET and the eventlog classes that exists in there
. Requires a bit of .NET
coding, though, using your favorite language. I don't have my code here, so
I don't recall the class
names etc, but reading the eventlog only requires a few lines of code.
You can do this using WMI as well, but as I'm not familiar with WMI programm
ing I decoded to use the
.NET classes instead.
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"-" <-@.-.com> wrote in message news:edlVk8r6DHA.2764@.TK2MSFTNGP09.phx.gbl...
quote:|||LOGPARSER from the IIS6 resource kit does exactly this
> Hi,
> I was wondering if there were a way to
> Export event logs directly to SQL. Does anyone know if this is possible
> using VBscript or any of the Resource Kit tools?
>
> Thanks.
>
http://www.microsoft.com/downloads/...&DisplayLang=en
regards
paul
"-" <-@.-.com> wrote in message news:edlVk8r6DHA.2764@.TK2MSFTNGP09.phx.gbl...
quote:sql
> Hi,
> I was wondering if there were a way to
> Export event logs directly to SQL. Does anyone know if this is possible
> using VBscript or any of the Resource Kit tools?
>
> Thanks.
>
Friday, March 9, 2012
Expected end of statement
i got this kind of error type:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/wanhe/services/update_succeed.asp, line 80, column 129
sqlStrDB = "update applicant set Name='"&username&"', Gender= '"&gender&"', Age='"&age&"',Marriage='"&maritalstatus&"',HighEdu='"&hEducation&"',EngScore='"&engScore&"',ToeflScore='"&toeflScore&"',IeltsScore='"&ieltsScore&"',FysmScore='"&fysmScore&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coEmail&"',AppSchool='"&appSchool&"',AppMajor='"&appMajor&"',Comment='"&coComment&"',companyNameCN='"&coNameCN&"',companyNameEN='"&coNameEN&"',CoAddress='"&coAddress&"',CoPostal='"&coPostal&"' where ID = "&userID&""
this is my coding:
<%
dim cnStrDB
dim rcSetDB
dim sqlStrDB
'create connection and recordset objects
Set cnStrDB = Server.CreateObject("ADODB.Connection")
Set rcSetDB = Server.CreateObject("ADODB.Recordset")
' connection string
dim pathDB
dim providerDB
' change this path to your database path
pathDB = "C:\Inetpub\wwwroot\wanhe\services\oApplication.mdb "
providerDB = "Microsoft.Jet.OLEDB.4.0"
' defining database connection (connectionstring.asp)
cnStrDB.ConnectionString = pathDB
cnStrDB.Provider = providerDB
cnStrDB.Mode = 3
cnStrDB.open
dim username
Dim coNameCN
Dim coNameEN
Dim coAddress
Dim coPostal
dim gender
dim age
dim maritalstatus
dim hEducation
dim engScore
dim toeflScore
dim ieltsScore
dim fysmScore
dim ncetScore
dim appSchool
dim appMajor
Dim coTel
Dim userID
Dim coMobile
dim coEmail
dim coComment
username = request.form("userName")
coNameCN = request.form("txtCoNameCN")
coNameEN= request.form("txtCoNameEN")
coAddress= request.form("txtCoAddress")
coPostal= request.form("txtPostal")
coTel= request.form("Tel")
coMobile= request.form("Mobile")
coEmail= request.form("Email")
coComment= request.form("Comment")
gender= request.form("Gender")
age= request.form("Age")
maritalstatus= request.form("Age")
hEducation= request.form("highEdu")
'response.write hEducation
'response.end
engScore= request.form("EngScore")
toeflScore= request.form("ToeflScore")
ieltsScore= request.form("IeltsScore")
fysmScore= request.form("FysmScore")
ncetScore= request.form("NcetScore")
appSchool= request.form("AppSchool")
appMajor= request.form("AppMajor")
userID=Request.cookies("ID")
sqlStrDB = "update applicant set Name= '"&username&"', Gender= '"&gender&"', Age='"&age&"',Marriage='"&maritalstatus&"', HighEdu='"&hEducation&"', EngScore='"&engScore&"',ToeflScore='"&toeflScore&"',IeltsScore='"&ieltsScore&"',FysmScore='"&fysmScore&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coEmail&"',AppSchool='"&appSchool&"',AppMajor='"&appMajor&"',Comment='"&coComment&"',companyNameCN='"&coNameCN&"',companyNameEN='"&coNameEN&"',CoAddress='"&coAddress&"',CoPostal='"&coPostal&"' where ID = "&userID&""
rcSetDB.ActiveConnection = cnStrDB
rcSetDB.cursorType = 3 'for add record into database
rcSetDB.cursorLocation = 3
rcSetDB.open(sqlStrDB)
%>
i know it's somehting wrong with
HighEdu='"&hEducation&"
but i cant find where is wrong
anyone can helps me??
thanks a lot
:()Maybe that "" at the end should have been ";"?
You should really use prepared statements with bind variables. Not only do they improve performance and remove a security loophole, they also make it easier to write your SQL:
sqlStrDB = "update applicant set Name=?, Gender=?, Age=?,Marriage=?, HighEdu=?, ... , CoPostal=? where ID = ?;"|||same error message|||your first line:
sqlStrDB = "Your statement" _ (add the "_" at the end)
your second line:
& "Your statement" (add "&" at the first)
try to manipulate it if error happens again. I think it should work because you have to separate your string to another lines by these characters.
regards.
chris|||the problem is the variable name
i change to another name can liao
by the way thanks for ur help
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/wanhe/services/update_succeed.asp, line 80, column 129
sqlStrDB = "update applicant set Name='"&username&"', Gender= '"&gender&"', Age='"&age&"',Marriage='"&maritalstatus&"',HighEdu='"&hEducation&"',EngScore='"&engScore&"',ToeflScore='"&toeflScore&"',IeltsScore='"&ieltsScore&"',FysmScore='"&fysmScore&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coEmail&"',AppSchool='"&appSchool&"',AppMajor='"&appMajor&"',Comment='"&coComment&"',companyNameCN='"&coNameCN&"',companyNameEN='"&coNameEN&"',CoAddress='"&coAddress&"',CoPostal='"&coPostal&"' where ID = "&userID&""
this is my coding:
<%
dim cnStrDB
dim rcSetDB
dim sqlStrDB
'create connection and recordset objects
Set cnStrDB = Server.CreateObject("ADODB.Connection")
Set rcSetDB = Server.CreateObject("ADODB.Recordset")
' connection string
dim pathDB
dim providerDB
' change this path to your database path
pathDB = "C:\Inetpub\wwwroot\wanhe\services\oApplication.mdb "
providerDB = "Microsoft.Jet.OLEDB.4.0"
' defining database connection (connectionstring.asp)
cnStrDB.ConnectionString = pathDB
cnStrDB.Provider = providerDB
cnStrDB.Mode = 3
cnStrDB.open
dim username
Dim coNameCN
Dim coNameEN
Dim coAddress
Dim coPostal
dim gender
dim age
dim maritalstatus
dim hEducation
dim engScore
dim toeflScore
dim ieltsScore
dim fysmScore
dim ncetScore
dim appSchool
dim appMajor
Dim coTel
Dim userID
Dim coMobile
dim coEmail
dim coComment
username = request.form("userName")
coNameCN = request.form("txtCoNameCN")
coNameEN= request.form("txtCoNameEN")
coAddress= request.form("txtCoAddress")
coPostal= request.form("txtPostal")
coTel= request.form("Tel")
coMobile= request.form("Mobile")
coEmail= request.form("Email")
coComment= request.form("Comment")
gender= request.form("Gender")
age= request.form("Age")
maritalstatus= request.form("Age")
hEducation= request.form("highEdu")
'response.write hEducation
'response.end
engScore= request.form("EngScore")
toeflScore= request.form("ToeflScore")
ieltsScore= request.form("IeltsScore")
fysmScore= request.form("FysmScore")
ncetScore= request.form("NcetScore")
appSchool= request.form("AppSchool")
appMajor= request.form("AppMajor")
userID=Request.cookies("ID")
sqlStrDB = "update applicant set Name= '"&username&"', Gender= '"&gender&"', Age='"&age&"',Marriage='"&maritalstatus&"', HighEdu='"&hEducation&"', EngScore='"&engScore&"',ToeflScore='"&toeflScore&"',IeltsScore='"&ieltsScore&"',FysmScore='"&fysmScore&"',NcetScore='"&ncetScore&"',Tel='"&coTel&"',Mobile='"&coMobile&"',Email='"&coEmail&"',AppSchool='"&appSchool&"',AppMajor='"&appMajor&"',Comment='"&coComment&"',companyNameCN='"&coNameCN&"',companyNameEN='"&coNameEN&"',CoAddress='"&coAddress&"',CoPostal='"&coPostal&"' where ID = "&userID&""
rcSetDB.ActiveConnection = cnStrDB
rcSetDB.cursorType = 3 'for add record into database
rcSetDB.cursorLocation = 3
rcSetDB.open(sqlStrDB)
%>
i know it's somehting wrong with
HighEdu='"&hEducation&"
but i cant find where is wrong
anyone can helps me??
thanks a lot
:()Maybe that "" at the end should have been ";"?
You should really use prepared statements with bind variables. Not only do they improve performance and remove a security loophole, they also make it easier to write your SQL:
sqlStrDB = "update applicant set Name=?, Gender=?, Age=?,Marriage=?, HighEdu=?, ... , CoPostal=? where ID = ?;"|||same error message|||your first line:
sqlStrDB = "Your statement" _ (add the "_" at the end)
your second line:
& "Your statement" (add "&" at the first)
try to manipulate it if error happens again. I think it should work because you have to separate your string to another lines by these characters.
regards.
chris|||the problem is the variable name
i change to another name can liao
by the way thanks for ur help
Labels:
0x800a0401,
asp,
compilation,
database,
error,
expected,
line,
microsoft,
mysql,
oracle,
server,
services,
sql,
statement,
typeerror,
typemicrosoft,
update_succeed,
vbscript,
wanhe
Subscribe to:
Posts (Atom)