Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Carriage return in INSERT
Message
De
28/07/2009 16:16:09
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01414914
Message ID:
01415167
Vues:
40
>>>>>>Do you remember the other thread about the null problem? I was/am using the string as a parameter passed into a SP to overcome the nulls not allowed problem. I have not been able to get the SET NULL to work from within the connection string. :(
>>>>>>Here's what was suggested but it doesn't work. Maybe I just didn't understand enough.
>>>>>>
>>>>>>
>>>>>>  <add name="TIPWebEdits" connectionString="Provider=VFPOLEDB.1;Data Source=C:\Inetpub\wwwroot\netTIP\App_Data\Tip_WebEdits\tip_webedits.dbc;NULL=No"
>>>>>>   providerName="System.Data.OleDb" />
>>>>>>
>>>>>>
>>>>>Are you sure you want NULL=No, may be you want NULL=Yes ?
>>>>>
>>>>>See http://www.connectionstrings.com/visual-foxpro
>>>>>
>>>>>and it's referenced from http://social.msdn.microsoft.com/Forums/en-US/visualfoxprogeneral/thread/2eeed0dc-9199-48cb-910c-c661e9096cfe
>>>>
>>>>I've tried YES,NO,OFF,ON all with the same result. Any other ideas?
>>>
>>>Not really, except for forgetting the INLINE Insert statement, move the logic to VFP/SP and have SET NULL OFF there.
>>Well, that's basically what I did. I built a SP
>>procedure ExecuteSQL(SQLstatement)
>>set null off
>>execscript(SQLStatement)
>>and passed the SQL string to it. But then I ran into the problem with the carriage returns in the memo fields. :(
>
>No, I meant create a normal SP with parameters and use it for insert, e.g.
>
>mySPInsert(myFieldVal1, myFieldVal2, etc.)
>
>set null off
>insert into myTable (field1, field2, field2) values (myFieldVal1, myFieldVal2, etc.)
>
>Or did we run into the problem of passing parameters to VFP SP before?

Oh, I'm sure we discussed it before, and Viv was involved too. I'm just not comfortable with it yet and don't even remember which project it was I was working on at the time. It takes a while to shift from something your comfortable with to something new where you have to go look it up everytime. :)
Anyhow, I have the immediate problem solved by using the NET parameters technique. Now I have a new problem which is how to deal with blank dates. On my page there are several date textboxes that are populated like this.
s_Scoping_TextBox.Text = IIf(oReader("s_scoping") > #1/1/2000#, oReader("s_scoping"), #1/1/1899#)
The 1/1/2000 is arbitrary and the 1/1/1899 is just a workaround to deal with what should be a blank.
In the save mode it looks like this
oCommand.Parameters.AddWithValue("s_scoping", DateTime.Parse(s_Scoping_TextBox.Text))
This works as you would expect but creates the problem where I am saving back 1/1/1899 instead of the original blank date. Any thoughts on how this should really be structured?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform