Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connecting to VFP Data in ASP.NET
Message
 
À
29/12/2005 14:52:49
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
01072118
Message ID:
01082404
Vues:
23
Thanks again Cetin. If I'm going the vfp route, are there any other major differences in syntax from using SQLSERVER? My main concern is my selectcommand string. I have to form it according to VFP rules I assume.
I am having trouble with variables in vb.net and my statement as follows:
vDataSource2.SelectCommand = "SELECT title, type_dish FROM dish WHERE title LIKE '%' + @box1 + '%')"
Does vfp handle @variables like this do you know?


>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.
>>>>>>
>>>>>>
"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."
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform