Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Upload to SQLServer
Message
De
04/12/2008 16:17:54
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01365523
Message ID:
01365550
Vues:
16
>>>>Is it possible to use VFP code to upload data into a SQL Server Express table? Does anyone have a sample script to do this?
>>>>Thanks
>>>
>>>You can handle Express edition as you handle other editions "Standard, Enterprise, etc"
>>>There is NO difference between them in VFP point of view.
>>>You set a connection, do something (run a query to get result, insert/delete/update some data)
>>>
>>>So, if you know how to do this in other editions, you are fine with Express also.
>>
>>Thanks Borislav.
>>Its a big assumption to suggest I know how to do it in other editions. Here is my attempt to connect and EXTRACT data. (I figure that if I can get it out then I can also put it in.)
>>
>>lnHandle = sqlconnect("trpSurvey")
>>	
>>text to lcSQL textmerge noshow pretext 15
>>	select * 
>>	from userValidation
>>endtext	
>>
>>if sqlexec(m.lnHandle,lcSQL,"crsImport",aCountInfo) < 0
>>	aerror(laError)
>>	messagebox(laError[1,2])
>>endif
>>
>>sqldisconnect(m.lnHandle)
>>select crsImport
>>browse
>>But I get an error that says userValidation is an invalid object name. It IS the name of the table and the connection is good. Is there another way to refer to the table?
>>Thanks
>
>
>What is trpSurvey?
>I suppose it is DSN or Connection stored in your database.
>So are you sure it is connected to right Database or server?
>What you get from this:
>
>lnHandle = sqlconnect("trpSurvey")
>IF lnHandle > 0
>   TEXT TO lcSQL NOSHOW
>        SELECT @@SERVERNAME AS SrvName, DB_NAME() AS DbName
>   ENDTEXT
>   if sqlexec(m.lnHandle,lcSQL,"crsImport",aCountInfo) < 0
>      aerror(laError)
>      messagebox(laError[1,2])
>   ELSE
>      BROWSE NORMAL
>   endif
>   sqldisconnect(m.lnHandle)
>ELSE
>   aerror(laError)
>   messagebox(laError[1,2])
>ENDIF
>
TRPSurvey is the name of a named connection in the database. After running your code it was apparent to me that it was not formed properly because it pointed to our master network server rather than my local PC. I guess I need some help creating the connection. The SQL file I need to get to is located at C:\Inetpub\wwwroot\TRPsurvey\App_Data\aspnetdb.mdf. It has been created with the Visual Web Developer Express as part of a web project. I have reworked the connection to point to my PC and it verifys the connection if the database is left blank, but if I add the database it fails and says access to the selected database has been denied. There is nothing else holding the database open so perhaps I need to register it with SQLServer or something? It does not show up as a choice in the login window.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform