NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 31 32 33 34 35 … 93 Next »
SQL database and backticks

 
  • 0 Vote(s) - 0 Average
SQL database and backticks
idkpmiller
Offline

Posting Freak

Posts: 817
Threads: 141
Joined: May 2006
#1
2008-05-25, 11:01 AM
I am getting the error below, this I belive is because of the backtick in the filename. how are people dealing with SQL when the string you want to store has a backtick?

Thanks

error:

Code:
2008-05-25 22:53:50.312    VERBOSE    [1]    ReturnToMainMenu()@2
2008-05-25 22:53:50.328    VERBOSE    [1]    System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression ''/fullscreen "\\Htpc\mp3\C\Carl Perkins\05_Honey_Don't.mp3"', '1', '25/05/2008 10:53:50 p.m.')'.
   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
   at GameZone.CommonUtilities.SQLInsUpd(String SQLQuery) in H:\GB-PVR\project\GameZone 2.3\GameZone 2.3\GameZone 2.3\CommonUtilities.vb:line 100
   at GameZone.GameZone.GameZoneTask.AddTopTen(String media, String FileName, String DisplayFileName, String selectedEmulator, String emulatorexe, String emulatorarg) in H:\GB-PVR\project\GameZone 2.3\GameZone 2.3\GameZone 2.3\GameZoneTask.vb:line 1080
   at GameZone.ProcUtils.Launch(String media, String FileName, String DisplayFileName, String selectedEmulator, String emulatorpath, String emulatorarg, String emulatorExe) in H:\GB-PVR\project\GameZone 2.3\GameZone 2.3\GameZone 2.3\ProcUtils.vb:line 119
   at GameZone.GameZone.GameZoneTask.PreLaunchCheck(String media, String FileName, String DisplayFileName, String selectedEmulator, String emulatorpath, String emulatorarg, String emulatorExe) in H:\GB-PVR\project\GameZone 2.3\GameZone 2.3\GameZone 2.3\GameZoneTask.vb:line 2981
   at GameZone.GameZone.GameZoneTask.Controls_OnKeyDown(KeyEventArgs e) in H:\GB-PVR\project\GameZone 2.3\GameZone 2.3\GameZone 2.3\GameZoneTask.vb:line 2001
   at GameZone.GameZone.GameZoneTask.OnKeyDown(KeyEventArgs e) in H:\GB-PVR\project\GameZone 2.3\GameZone 2.3\GameZone 2.3\GameZoneTask.vb:line 1350
   at GBPVRX2.MenuTask.x9006c1ed9ccb79de.OnKeyDown(KeyEventArgs e)
   at GBPVRX2.x0061b801bdf12d35.xdae9991ab918b397(Object xdf2e3583f942db7b, KeyEventArgs xc4f45905cb1fc7ba)
   at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at GBPVRX2.x0061b801bdf12d35.WndProc(Message& m)
2008-05-25 22:53:51.671    VERBOSE    [1]    ShowMouse ref=0
2008-05-25 22:53:53.062    VERBOSE    [1]    Preparing for shutdown
2008-05-25 22:53:53.125    VERBOSE    [1]    Exiting...
Let the Games begin...Round 2!
GameZone v2.9.6 - PVRx2 1.4.7 compatible!

[Image: 1299379.png]
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#2
2008-05-25, 02:28 PM (This post was last modified: 2008-05-25, 05:29 PM by pBS.)
isn't there a conversion equiv? like " or something like that? i think that's vb..
umm,sometimes doubling it up works..''

that's all i got....Big Grin
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#3
2008-05-25, 07:42 PM
pBS has got it. Before cooking the filename into the expression, change the ' to '' (two single quotes, not one double).

Just append .Replace("'", "''") to the filename string as you add it.
idkpmiller
Offline

Posting Freak

Posts: 817
Threads: 141
Joined: May 2006
#4
2008-05-25, 08:51 PM
Ommina Wrote:pBS has got it. Before cooking the filename into the expression, change the ' to '' (two single quotes, not one double).

Just append .Replace("'", "''") to the filename string as you add it.

Unfortunately I have tried that, Although not convinced its working, so with the news that it may be the correct way forward. I will try again when I get home tonight :-)

Cheers
Let the Games begin...Round 2!
GameZone v2.9.6 - PVRx2 1.4.7 compatible!

[Image: 1299379.png]
Ommina
Offline

Senior Member

Posts: 330
Threads: 39
Joined: Feb 2006
#5
2008-05-25, 09:06 PM
Hmm - the single quote will definitely mess with things. If it is still putting up a fuss, maybe post the SQL string you're passing to the command object and we'll take it apart from there. Can always turn it into parameters if it is going to stamp its feet and complain.

As an aside -- which SqLite OLEDB provider are you using? (Well, guess that assumes you're using Sqlite.)
idkpmiller
Offline

Posting Freak

Posts: 817
Threads: 141
Joined: May 2006
#6
2008-05-26, 08:10 AM
Here is the SQL query, I am using a access db with the Oledbconnector

Code:
Dim NumOfPlaysQuery As String = "SELECT TTGames.TTNumberofPlays FROM(TTGames)WHERE TTGames.TTFileName=" & Chr(34) & FileName & Chr(34) & " AND TTGames.TTMedia = " & Chr(34) & media & Chr(34) & " AND TTGames.TTEmulator =" & Chr(34) & selectedEmulator & Chr(34) & " AND TTGames.TTROMPath =" & Chr(34) & ROMPath & Chr(34) & " AND TTGames.TTDisplayName =" & Chr(34) & DisplayFileName & Chr(34)

I am just going to check why the backtick doesnt seem to be being replaced correctly as I said I was replacing a single backtick with a double the error seems to suggest this is not happening :-(
Let the Games begin...Round 2!
GameZone v2.9.6 - PVRx2 1.4.7 compatible!

[Image: 1299379.png]
idkpmiller
Offline

Posting Freak

Posts: 817
Threads: 141
Joined: May 2006
#7
2008-05-26, 08:32 AM
problem solved!

Yay!

The resoluton was to change the single backtick to a double the additional problem I had was it wasnt the filename per se that was causing the problem it was the embedded filename with the emulatorargs that was causing the issue and I had not replaced the backtick before the filename was embedded in to the emulatorarg varible :o

Oh well nevermind...

Thanks guys for the assistance

Cheers
Let the Games begin...Round 2!
GameZone v2.9.6 - PVRx2 1.4.7 compatible!

[Image: 1299379.png]
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Delete recordings from database but not from disk? spinnaker 8 3,745 2013-10-26, 10:51 PM
Last Post: spinnaker
  trying to fake npvr database for unit tests reven 3 2,237 2013-05-20, 08:53 AM
Last Post: reven
  Merged database queries mvallevand 4 2,050 2011-06-26, 09:56 PM
Last Post: mvallevand
  NPVR database questions mvallevand 25 9,776 2011-01-06, 12:58 AM
Last Post: jksmurf
  NPVR database - why so stringy with the fields?? :0) carpeVideo 4 1,985 2010-09-21, 01:48 AM
Last Post: sub
  NPVR Database connection ralphy 4 2,428 2010-09-15, 12:09 AM
Last Post: sub
  How can I reset the Music plugin's database? mkenyon2 1 1,881 2009-10-15, 06:43 PM
Last Post: psycik
  SheduleRecording() locks database cb123 3 2,474 2009-02-14, 06:33 PM
Last Post: sub
  accessing database fluffykeith 3 1,852 2008-07-09, 05:43 PM
Last Post: sub
  Does this code lock the database? pastro 19 5,333 2008-05-22, 10:06 AM
Last Post: Ommina

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode