Currently we use a windows 2003 (IIS 6.0) server with SQL Server 2008 R2 that runs perfectly a asp classic code. We are migrating to windows 2016 server with the same version of SQL Server. In most of the code it was necessary to put the full database path. The original that works on the other server, e.g.:
SELECT * from File
when changing to
SELECT * from [TABLE].[dbo].[File]
the new server can execute and read correctly.
In the part that the code itself has the legible queries is easy to understand. I do not know the asp classic well and the original code has variables with the same table name so I do not know if the called code item is actually the table or the variable.
I think it's something from the environment to set up. Would it be possible to resolve this without having to change the whole code?
I try to understand the error from logfile from IIS.
Maybe someone have the same situation, I solve this change the DSN connection (ODBC)
Dim rs
Dim conexao
Set conexao = Server.CreateObject("ADODB.Connection")
conexao.Open "DSN=database","sa","password1234"
I change the last line to use Provider too like example:
conexao.Open "Provider=SQLNCLI10;Server=nameserver\nameinstance;Database=namedatabase;UID=sa;PWD=password1234;"
Related
We have an old Access 2000 database that we need to pull data from and store it into a text file via a web interface that has to run every 20 minutes. I have spent hours and hours searching for a correct connection string without anything working.
I even used Dreamweaver's point-and-click solution and was able to get it to connect and pull data with a System DSN on my local machine, but it shows a 500 Internal Server Error when I upload it to the testing server (both the local and the testing server System DSNs have the same name). (For clarification to die-hard programmers, I am a developer and am using Dreamweaver because I have no idea what I'm doing with ASP.)
I created a System DSN on the testing server (win server 2008), but it doesn't seem to work. I don't know if it's something with the VB code I'm writing or an issue with the DSNs. Could I please get some help with this, my deadline for this is tomorrow morning! (If I don't meet the deadline, major systems in our business will not work!)
Dreamweaver Connection:
Dim MM_LocalDb_STRING
MM_LocalDb_STRING = "dsn=Db;"
Dim Students
Dim Students_cmd
Dim Students_numRows
Set Students_cmd = Server.CreateObject ("ADODB.Command")
Students_cmd.ActiveConnection = MM_LocalDb_STRING
Students_cmd.CommandText = "SELECT * FROM Students"
Students_cmd.Prepared = true
Students = Students_cmd.Execute
Students_numRows = 0
I have also seen various connection strings and have tried them with no success. Please help! (Thank you in advance.)
If you can, try accessing the page locally on the test server. I believe this should give you a more specific error than just the generic 500.
My thought, because this works on your dev machine, is that it's a permissions error. You should make sure that the IUSR and, I think, LOCAL SERVICE accounts have read/write permissions to the database file.
I'm building a website for a client that uses a FoxPro desktop database system.
The data that should be shared between the database and website is essentially a list of members (fairly flat structure: their contact details, a few flag fields etc)
They'd like any changes that are made to these member details to be automatically synched through to the website (mysql database). It doesn't need to be totally instant but the process needs to be easy.
My question is what are the simplest approaches that could be used here? they are willing to compromise a bit to save development time/cost.
Is there an easy way for FoxPro could talk directly to my online MySQL database?
Could FoxPro create an XML or CSV type file and pass it to a web script? (which i then parse and update MySQL with)
Any suggestions appreciated.
You could use either ODBC or OLE DB from Visual FoxPro. Using ODBC is typically fairly straightforward.
Use SQLConnect or SQLStringConnect to connect to the server.
Some connection string examples show what might work for the SQLStringConnect call.
Then call SQLExec to run some queries.
Foxpro has an intrinsic function CURSORTOXML, which will take a table and convert it to XML
It is fairly well documented in the help files, but here is a simple example of its use
LOCAl lcXML,lnRecords
use my_table
lnRecords=CURSORTOXML('my_table','lcXML',0)
? lnRecords
? lcXML
Hope this helps
Try this:
Create a Shared Folder on your Web Server.
Create a CSV of your Data and save on the Shared Folder.
Create a Cron Jobs/ Scheduler to parse and dump the data to your Mysql.
This works for me.
Get the odbc driver from here: https://dev.mysql.com/downloads/connector/odbc/
You may also need Microsoft Visual C++ 2010 Redistributable Package (x86) vcredist_x86.exe
Use this code to establish the mysql connection
PUBLIC server,port,db,uid,pw
server="" & use mysql ip
port="" & port mysql is open on
db="" & db name
uid="" & user anme
pw="" & password
mysql = SQLSTRINGCONNECT('Driver={MySQL ODBC 5.3 Unicode Driver};Server=' + server + ';Port=' + port + ';Database=' + db + ';uid=' + uid + ';Pwd=' + pw + ';',.T.)
IF VARTYPE(mysql) == 'L' OR m.mysql < 0
MESSAGEBOX('MySQL Connection Failed. Logging will be disabled for this session.',16,'MySQL Error',3500)
ENDIF
Here's an example to do an insert into a mysql table. I use it for logging user actions into mysql.
IF VARTYPE(mysql) != 'L' AND m.mysql >= 0
SQLPREPARE (;
m.mysql;
,'INSERT INTO logging (computer,operator,application,program,version,action) VALUES (;
?COMPUTERNAME ;
,?OPERATOR ;
,?thisApplication ;
,?thisProgram ;
,?thisVersion ;
,?logMessage;
);';
)
SQLEXEC(m.mysql)
ENDIF
You can use XML for sending information to web application by HTTP REQUEST.
to create/read XML in foxpro, you can use CURSORTOXML/XMLTOCURSOR.
In your web application, you can create a web service to receive/send XML data.
If you want another data type, you can use JSON data. Use QDFOXJSON https://qdfoxjson.codeplex.com/
I'd say your quickest/easiest bet is probably to do the following via a nightly script:
export your FoxPro data to XML
push the data into the MySQL database using something like Python or Java
In the long run though, you're probably better off totally ditching FoxPro after the initial import ;)
I have written code that joins two table in access, using criteria supplied from drop down lists in Excel and then returns the data to a specific location on the spreadsheet (titles already on the sheet).
This works fine on my box and others with MS Access on the machine, but the purpose of writing this was to give people (associates) that don't have MS Access on their machines (which is most of them) to be able to do simple queries to the database.
When we try to run this on a machine without MS Access, we are getting the error message
"Compile Error: Can't find project or library."
Since this works fine on any machine so far that has Access, but not the others I am wondering if this is not possible without the actual Access software. Any help or insight would be appreciated.
you need to use ADO and the "jet" provider. This will allow you to query an access database without having access installed
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set objRecordset=Server.CreateObject("ADODB.recordset")
objRecordset.activeconnection = conn
objRecordset.source = "select * from table where field1 = 'asdf'"
objRecordset.open
'do you work here
objRecordset.close
conn.close
I've used LINQ to SQL in a unit testing project to mock some test data. I've changed the database name today and consequently the LINQ to SQL code doesn't work any more. I get the following error 'System.Data.SqlClient.SqlException: Cannot open database "XXX" requested by the login. The login failed'. I've tried changing the Connection property on the DataContext in the designer but this doesn't work. I've tried changing the connection string in app.config as well but this doesn't work as well. Is there anything I missing here?
I managed to solve this problem: In opened up the .dbml file in the XML editor (rather than the designer) and found a Database element with the old database name referenced. Once I changed this then everything was OK.
I need to know if it is possible to dynamically bind a textbox residing within a datarepeater to a 'dynamically' created BindingSource. I am using VB.net. The database I am using is a MySQL database.
I have to use the connection dynamically due to the fact that the database my not permanently reside on the same server.
[edit]
ok, so it seams that I am a dolt when asking questions. The app that I am making is not web based. it is a simple (I hope) app that connects to a MySQL database, accesses a table so I can edit/view it. Current setup is using the Add DataSource wizard. I have successfully connected to the dbase dynamically using the mysql connector dll but without the textboxes set at design time to a datasource, I am unsure on how to 'link' them via the datarepeater.
Your connection string should be defined in your Web.Config, and if you move your database to a different server, it's just a matter of modifying the web.config entry. As long as you keep the connection string name the same, the BindingSource object will pick up the new value from the config.edit
In truth, the same concept should apply here as it does in the web app answer listed above.
All of your data objects should be hard-coded, and it's just the connection string (which you'll have to either ask the user for, or push out as update when the DB moves) which will get modified.
For example, create a App.Config file in your project. Have one of your configuration values be the connection string. This config value will be where you go to get the connection string whenever you need it. Then your wizard will be there to allow users to easily modify the connection.
then look in app.config
the conenction string should be there.
If it is not then you should put it in here as you can change this file at any time and not have to recompile your app.