Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Upload to SQLServer
Message
From
04/12/2008 17:50:10
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01365523
Message ID:
01365557
Views:
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.
>
>
>If the SQL Server Express is installed to your computer and you are the administrator of that computer you can use Windows Authentication instead of SQL Server one.
>Also, keep in mind that default installation of SQL Server Express create a named instance "SQLEXPRESS". So, what happens with this:
>
>lnHandle = SQLSTRINGCONNECT("Driver=SQL Server;Server=.\SQLEXPRESS;DataBase=TheNameOfTheDB;Trusted_Connection=yes;")
>IF lnHandle < 0
>   AERROR(laError)
>   messagebox(laError[1,2]) 
>ENDIF
>
This works. Thanks.
Is there a way to turn this into a named connection?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform