Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to VFP Data in ASP.NET
Message
From
29/12/2005 14:52:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
01072118
Message ID:
01081784
Views:
24
Yes your updates/inserts will work OK.
In VFP you could have a field named (for example-never do that) 'table'. ie:
Create Table Table (Table i)
For ix = 1 To 10
  Insert Into Table (Table) Values (m.ix)
Endfor
Select Table From Table
As ugly as it gets but you can do it! Notice that I used keyword 'table' as a tablename, as well as a columnname in that table. In SQL server keywords are not allowed in this fashion. However still in SQL server you could do the same using angle brackets (which tells SQL server that it is a name rather than a keyword). ie:
Create Table [Table] ([Table] i)
For ix = 1 To 10
  Insert Into [Table] ([Table]) Values (m.ix)
Endfor
Select [Table] From [Table]
In SQL server also you could have a field named "My field name with spaces in it" < g >. Again you could use such a field (not the only way):

select [My field name with spaces in it] from [myTable]

and SQL server knows you're referring to a single column. I have exagarated it a bit to show what it is for:)
Cetin

>Thank you !!! that did it! I never would have guessed that. What do the brackets mean in SQL server anyway? Since my data is in vfp, I wanted to phase out sql server. Will the updates, and inserts work in .NET 2 with VFPOLEDB ok?
>
>
>>Oh this is 2.0, right? I don't have it here to test but at a glance this drew my attention:
>>"SELECT [title], [type_dish] FROM [dish] ..."
>>You're using VFPOLEDB so this string is evaluated by VFP's engine. While in SQL server and MSAccess you can use angle brackets for fieldnames, in VFP it has a special meaning. Under VFP angle brackets, double and single quotes all are used as string delimiters. IOW if you execute this SQL you'd get back N rows matching your where clause but all rows would have "title" and "type_dish" in it. Try:
>>"SELECT title, type_dish FROM dish ..."
>>
>>Cetin
>>
>>
>>>Sure can, here is one of the apps(at home) that is giving me the same exact type of prob at work. In VS.net, I can show table data just fine in the 'database explorer' tab.
>>>
>>>
>>><body>
>>>    <form id="form1" runat="server">
>>>    <div>
>>>        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="vDataSource1">
>>>            <Columns>
>>>                <asp:BoundField DataField="exp_1" HeaderText="exp_1" SortExpression="exp_1" />
>>>                <asp:BoundField DataField="exp_2" HeaderText="exp_2" SortExpression="exp_2" />
>>>            </Columns>
>>>        </asp:GridView>
>>>        <asp:SqlDataSource ID="vDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:vConnectionString %>"
>>>            ProviderName="<%$ ConnectionStrings:vConnectionString.ProviderName %>"
>>>SelectCommand="SELECT [title], [type_dish] FROM [dish] where recno()<22">
>>>        </asp:SqlDataSource>
>>>
>>>    </div>
>>>    </form>
>>>
>>>
>>>>Would you show part of your code,especially SelectCommand.
>>>>Cetin
>>>>
>>>>>Well, I sort of have it working now. When the web site loads, the dropdowns and gridview show exp_1,exp_2 for field headers and the grids display the field names as if it were data. Strange.
>>>>>
>>>>>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform