Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to VFP Data in ASP.NET
Message
 
To
03/01/2006 20:04:05
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
01072118
Message ID:
01082963
Views:
33
my previous post got sent to me, here's what I mentioned:
Scratch that, I figured out that there was an extra single quote supplied. I replaced textbox1 with a var for simplicity. IT works!! Thank you. The thing is this leaves me open to injection attack?
>Tim,
>
>It's probably the TextBox1.Text ... I don't know what your TextBox is called (or where you're getting the variable that you're plugging into the Select statement that you're building).
>
>~~Bonnie
>
>
>
>>Bonnie, Thanks for weighing in on this. Cetin is a guru way above me. I am kinda new to this .net, but in taking your advice, yields this error: Command contains "unrecognized phrase/keyword."
>>without it pointing to exactly what the error is. For one, you had a mismatch of parenthesis, I removed it, but still got the error. BTW I use VB here( but was disapointed when the .net developers left VFP in the dust)
>>
>>
>>
>>>Tim,
>>>
>>>>Cetin, isn't ADO for xml data? I have not delved into that before.<
>>>
>>>PMFJI ... no, ADO.NET isn't only for XML data. ADO.NET refers to anything you do with data ... that means the data store (DataSets, DataTables, etc), plus the data access. So, yes, you've used ADO.NET when you access SQL Server, VFP or any other database.
>>>
>>>You really should look into parameterizing your database calls, as Cetin has tried to explain. But, since you want an answer using your method of building a string, it would simply be something like this:
>>>
>>>Your way:
>>>
>>>vDataSource2.SelectCommand = "SELECT title, type_dish FROM dish WHERE title LIKE '%'" + TextBox1.Text + "'%')"
>>>
>>>Cetin's way:
>>>
>>>vDataSource2.SelectCommand = String.Format("select * from myTable where title like '%{0}%'", TextBox1.Text)
>>>
>>>
>>>Both methods will give you the same SelectCommand string.
>>>
>>>~~Bonnie
"Build a man a fire, and he's warm for a day.
Set a man on fire, and he's warm for the rest of his life."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform