06. april 2007 - 16:23
Der er
3 kommentarer
sende besked til alle brugere
Få dette script til at sende samme besked ud til alle brugere i databasen? Set Conn = Server.CreateObject("ADODB.Connection") DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; " DSN = DSN & "DBQ=" & Server.MapPath("s.mdb") Conn.Open DSN strSQL = "Insert into b (" strSQL = strSQL & "m," strSQL = strSQL & "e," strSQL = strSQL & "n," strSQL = strSQL & "t," strSQL = strSQL & "d)" strSQL = strSQL & "values( " strSQL = strSQL & "'"&m&"'," strSQL = strSQL & "'"&e&"'," strSQL = strSQL & "'"&Session("b")&"'," strSQL = strSQL & "'"&t&"'," strSQL = strSQL & "'"&Now&"')" Conn.Execute(strSQL) bruger tabellen hedder "b"
Annonceindlæg fra HP
06. april 2007 - 17:07
#1
Dine navne er ikke lige til at gennemskue, men du skal vel loope alle dine brugere i gennem. Hvis vi nu antager at 't' er dit brugerID så det gøres sådan her: <% Set Conn = Server.CreateObject("ADODB.Connection") DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; " DSN = DSN & "DBQ=" & Server.MapPath("s.mdb") Conn.Open DSN strSQL = "SELECT userID FROM users " Set rs = Conn.Execute(strSQL) Do While not rs.eof strSQL = "Insert into b (" strSQL = strSQL & "m," strSQL = strSQL & "e," strSQL = strSQL & "n," strSQL = strSQL & "t," strSQL = strSQL & "d)" strSQL = strSQL & "values( " strSQL = strSQL & "'"&m&"'," strSQL = strSQL & "'"&e&"'," strSQL = strSQL & "'"&Session("b")&"'," strSQL = strSQL & "'"& Int(rs("userID")) &"'," strSQL = strSQL & "'"&Now&"')" Conn.Execute(strSQL) strCount = strCount + 1 rs.MoveNext Loop Set rs = Nothing Response.Write "Der blev sendt besked til " & strCount & " brugere" %>s