Read & Write

access , db Indonesia
  • 13 years ago

    i  nv learn sql b4..alright alright, let me tell u exactly wat i wan. basically, my application run then lastly it iwl write the result into the text file which i last shown u. now wat i wan is, to write another code and ask the system to read the text file (which is done already) and store it into the access database. my database name is Quiz.mdb tat come wif a table name "marks" wif 3 columns namely "question", "date", "time". now the thing i wan is to read from text file and store it into the database. pls help Sad

     

    WrongQuestion.txt

    1,2,3,4,5,6,7,8,9,10
    11/19/2007
    3:29:30 PM

     

    ReadText.asp

    <html>

    <body>

    <% 

    Dim adoCon
    Dim rsAdd
    Dim strSQL


    Set adoCon = Server.CreateObject("ADODB.Connection")
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Quiz.mdb")
    'adoCon.Open "DSN=Quiz"
    Set rsAdd = Server.CreateObject("ADODB.Recordset")

    Set FS = Server.CreateObject("Scripting.FileSystemObject")
    'response.Write Server.MapPath("WrongQuestion.txt")
    Set RS = FS.OpenTextFile(Server.MapPath("WrongQuestion.txt"),1)
    While not rs.AtEndOfStream

    'Response.Write RS.ReadLine
    'Response.Write("<br />")

    strSQL = "insert into marks(question, date, time) VALUES ('" & value1 &"','"&value2&"','"&value3&"'"
    rsAdd.Update strSQL, adoCon


    Wend

    rsAdd.Close

    Set rsAdd = Nothing
    Set adoCon = Nothing
    Set FS = Nothing
    Set RS = Nothing

    %>

    </body>

    </html



     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”