![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Official Updates Updates to official libraries could be found here. This forum is only available to licensed users. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
The SQL library now supports parameterized queries.
Parameterized queries have several advantages over regular queries: - Easy to use. - No need to escape special characters. - Protect against SQL injections. - Significantly faster. See Command.AddParameter and Command.SetParameter for more information. Setup instructions: Download and extract the attached file. Copy all files to the libraries folder: C:\Program Files\Anywhere Software\Basic4ppc Desktop\Libraries Make sure to replace existing copies of SQLDesktop.dll and SQLDevice.dll with the new files. |
|
|||
|
Erel, it don't work on the device... Following code work on the desktop, but raises many errors on the device.
Code:
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
Con.New1
Cmd.New1("",con.Value)
Con.Open("Data Source = " & AppPath & "\Northwind.sl3")
Text="CREATE TABLE if not exists table1 (col1,col2)"
cmd.CommandText=Text
cmd.ExecuteNonQuery
cmd.AddParameter("value1")
cmd.AddParameter("value2")
cmd.CommandText = "INSERT INTO [table1] (col1,col2) VALUES (@value1,@value2)"
Con.BeginTransaction
cmd.SetParameter("value2","SomeValue")
For i = 0 To 10
cmd.SetParameter("value1",i * 2)
cmd.ExecuteNonQuery
Next
Con.EndTransaction
Con.Close
End Sub
|
|
|||
|
Is there anyway to use these parameter things with an UPDATE Sql command or do they only help with Inserts?
Edit: Got it! Turns out I'd got a comma in the wrong place which is why it didn't seem to be working! (Teach me to code when I should be in bed )Anyway, for anyone else with such problems: Code:
cmd.CommandText = "Update [Table] SET Col1 = @Value1, Col2 = @Value2 WHERE col3 = [whatever]" Last edited by Hennell : 08-18-2008 at 01:01 AM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hardware library was updated | Erel | Announcements | 0 | 03-01-2008 04:20 PM |
| Hardware library was updated - 3.10 | Erel | Announcements | 15 | 12-30-2007 03:18 PM |
| FormLib library was updated | Erel | Announcements | 5 | 08-16-2007 05:05 PM |
| FormLib library was updated | Erel | Announcements | 3 | 06-23-2007 06:27 PM |
| FTP library was updated | Erel | Announcements | 1 | 04-29-2007 03:04 PM |