aRo`

automating your e-commerce

Instead of writing your own code for checking if a user has access to a page just use the formauthentication that is available to u
web.config (mind the ‘ )

Parse error: syntax error, unexpected ‘

Javascript just offers a simple alert box without any customisation. With the code below u can call a VBscript function from javascript witch makes it possible to create your own alert box with or without an icon.
Javascript function
NS4 = (document.layers);
IE4 = (document.all);
ver4 = (NS4 || IE4);
function newAlert(title,mess,icon,mods) {
(IE4) ? makeMsgBox(title,mess,icon,0,0,mods) : alert(mess);
}
VBScript function

Function makeMsgBox(tit,mess,icons,buts,defs,mods)
butVal = [...]

Connection to Access Database

Imports System.Data.OleDb
Private Const strConnection As String = “Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb;
Private objConnection As OleDbConnection = New OleDbConnection(strConnection)
Try
objConnection.Open()
….
objConnection.Close()
Catch myException As System.Exception
MessageBox.Show(myException.Message)
End Try
Command – ExecuteNonQuery UPDATE / DELETE / INSERT
Dim strSQL As String = “Insert into tblX (X ,Y) values (valueX,valueY)”
Dim objCommand As OleDbCommand = New OleDbCommand(strSQL, objConnection)
objCommand.ExecuteNonQuery()
Command – ExecuteScalar SELECT

Dim strSQL [...]

The best way of connecting to a database is including a separated file with the database info. Afterwards u can always check if the database connection state is open.
MS SQL
set cnn = Server.CreateObject(“ADODB.Connection”)
cnn.ConnectionString = “Provider=SQLOLEDB.1;User ID=User;Passwd=;Initial Catalog=ASPDB;Data Source=server”
cnn.Open
Microsoft Access
set cnn = Server.CreateObject(“ADODB.Connection”)
cnn.Provider = “Microsoft.Jet.OLEDB.4.0″
cnn.ConnectionString = Server.MapPath (“/mywwwfolder”) & “\database.mdb”
cnn.Open
check connection state
if cnn.State = 0 then
cnn.Open
end [...]

« Previous Entries  Next Page »