Insert into table using macro in base [closed]

asked 2012-12-22 22:22:07 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am attempting to write a simple program in base. Unfortunately, I need to insert a piece of information using a macro. However, the method that I used (below) for a select query did not work, and I cannot use the properties window to link the fields to the database (I need more control over the statement). Is there a way to do this?

The method I used is:

DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext") DataSource = DatabaseContext.getByName("Laptops")

If Not DataSource.IsPasswordRequired Then
    Connection = DataSource.GetConnection("","")
Else
    InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
    Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If

Statement = Connection.prepareStatement("SELECT ""username"",""password"" FROM ""Users"" WHERE ""username"" LIKE ? AND ""password"" = ?;")
Statement.setString(1,Uname)
Statement.setString(2,Pwd)
ResultSet = Statement.executeQuery()
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by qubit
close date 2013-04-27 20:35:38.655511

Comments

Hi Anonymous, Did you ever find a solution to your problem?

qubit gravatar imagequbit ( 2013-03-03 00:17:20 +0200 )edit