C# :: Connection String With Relative Path
Jun 3, 2014
I have my application database in the AppDataRoaming folder. I'm trying to create a connection string for Telerik reporting, up until now I've had a connection string in a settings class that is put together like this:
The path is:
data source=C:UsersSynlightAppDataRoamingAppNamedataAppDB.sqlite
I've tried files paths like this:
%AppData%RoamingAppDatadataAppDB.sqlite
and
Server.MapPath(@"~App_DataRoamingAppDatadataAppDB.sqlite
(those are not the real directory names, of course). How do I create a connection string that will work on target machines?
View 5 Replies
ADVERTISEMENT
Sep 3, 2014
FILE* pFile = fopen ("./myfile.txt","w+");
Is there a way to change what a relative path is referencing after runtime has started?
My specific issue is that I have several existing 100,000+ LOC lua projects. I am building a new back-end in C/C++ for this by wrapping a Lua C library. The lua scripts use io.open("./path/relative/to/project/file") which translates to fopen(...) in C. The project file which this is relative to is opened by the user after the application has started.
I see two solutions, neither are particularly good:
1) Change every io.open() function in every project to be relative to a static location. I lose all flexibility if I do this.
2) Modify the Lua library to prepend a custom path to opened files. Modifying 3rd party libraries suck because you can't update the library without tracking patches.
3?) Ask cplusplus forum if there is a way to change the relative directory.
View 4 Replies
View Related
May 18, 2014
How it make it work for my project. Runtime means I am going to have to give the path at the command line?
Here is how I have to run it, so I can test it against the example inputs and outputs they give us to test our program. I am using putty. Already crated the folders inside my project folder, but don't know how to implement it on my source code.
./movie_stats < ./input/test1.in ./my-output/test1.out
What I'm thinking is to open/create the file test1.out in the my-output folder and open it at runtime?
View 1 Replies
View Related
Nov 29, 2014
private DataSet1 GetData(string query) {
string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
The above is erring out with NullReferenceException
View 6 Replies
View Related
Aug 25, 2014
So when I create the EF and use generate model from the database, I included the sensitive info into the connection string. Now I want to get the user to input password, userID, schema name, host into the connection string. I use Oracle as my database, so there is a need to put the schema name in it also.... How do I accomplish this task? Been trying to get it work but unsuccessful so far...
View 3 Replies
View Related
Sep 20, 2012
I have tried to connect my sql server 2005 using a domain name. i have bought a domain name and a dns client. this is my connection string
{ SqlConnection sqlconn =
new SqlConnection("user id=user1;" + "password=pass2;"
+ "server=www.mysite.infoServerInstance;"
+ "trusted_Connection=false;" + "network
library=DBMSSOCN;" + "Integrated security=false;"
+ "initial catalog=Mydatabase;" +"connection timeout=5
;"); }
I have added sql browser & sql server in fire wall, and also enabled tcp port 1433 and udp port 1434. the above connection string works perfect when i run it in the server machine, but whenIi try to run it on other machines I am getting an error that server is not available or cannot find the specified server.. I desperately need to access my database through an url. ie., through internet..
View 6 Replies
View Related
Mar 11, 2014
i've been writing some code for an assignment and it is mostly about pointers and string manipulations. It runs but crashes and I think it might be from over- valuating some strings maybe not. I have written in check points to make sure each function passes through but quits at findFirstPath loop, I had kept running the program through as i added more and more code. It had stopped when I near finished I believed it to just be because I hadn't finished the functions I called.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define MAXSTRING 10
#define TRUE 1
[Code]....
View 3 Replies
View Related
Apr 27, 2013
Is there any way in sfml version 2 that I can get objects in a graphics window to retain there relative positions and sizes when the window is resized? I have tried looking in the documentation for version 2 but with no luck.
As an example suppose the window is 800x600 and there is a line running right across the window at 3/4 of the way down (i.e at y=450). If the window is then made larger say 1280x1024 how would I keep the line in the same relative position (i.e all the way across 1280 and 3/4 of the y setting down).
View 3 Replies
View Related
Apr 2, 2014
How to get relative memory address of members of Class or Structure ? I want to auto scan the members of Class/Struct, and show the address/value like the "watch window" in debug mode of popular C/C++ IDE software.
View 2 Replies
View Related
Sep 22, 2014
For a while, I have been running a Windows 7 Visual Studio 2012 CPP project fine. However, today, all of a sudden, it has stopped being able to read any header files that are in relative directories. I cannot think what I have done to make this happen.
It seems to be an issue with Visual Studio as a whole, rather than my individual project, because I have created a new simple project and I am having the same problem. So, I have a CPP project at `C:/Projects/TestProject`. Then, I have a header file called `test_header.hpp`, which is located at `C:/Headers`. In `TestProject`'s project settings, I have added the directory `../../Headers` to `Additional Include Directories`. Then, my main functions is as follows:
Code:
#include "test_header.hpp"
int main() {
return 0;
}
Which gives me the error:
Code:
Error1error C1083: Cannot open include file: 'test.hpp': No such file or directoryc:projects estprojectmain.cpp11TestProject
Is there some global Visual Studio setting that is responsible for setting up these relative directories? Just in case the relative directory was not correct, I also tried a load of others, such as `../Headers` and `../../../Headers`, but these gave the same errors.
View 1 Replies
View Related
Mar 4, 2012
Code:
class A
{
std::map<std::string, Unit*> aMap;
class B
[Code] .....
This code snippet results in "A non-static member reference must be made relative to a specific object". When I make callA() static, this error goes away, but there is problem with aMap.
View 2 Replies
View Related
Jun 22, 2014
i have tried to search on the Internet but haven't found a suitable result that links in with what I want to do, that is to creation a WPF application and when you press a enable button it will enable the LAN and when I click the disable button it will disable the LAN until i click the enable button again. Now I know how to creation a WPF and the buttons, but how would I do the disabling LAN and enabling LAN?
By LAN i mean just the networking adapters, so that the PC cannot connect to a router and then the Internet.
View 14 Replies
View Related
Mar 15, 2013
Wondering why I cannot communicate with my microcontroller dspic33 with the Hyperterminal program. In the sample test code, I also cannot use printf. They have it set up differently and I am wondering if it is possible to redirect the output of the printf, scanf functions to the port I am using?
View 3 Replies
View Related
Jan 24, 2014
I am currently writing a small windos form app which relies on an internat connection.
The only issue I have is trying to find out how to force the app to reconnect if the internet drops out without the app crashing. From what I have read I could use "try and catch" but I am not sure how to do this.
The code I have so far is: for testing I am using [URL] as the web site target.
Form1.Designer:
namespace Browser2014
{
partial class Form1
{
[Code]....
View 3 Replies
View Related
Feb 19, 2013
I'm getting this error.
SQLite error
near "16": syntax error
On the code:
private void btnUpdate_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
[Code]....
With breapoints etc it does show the values it has to insert into my database. But it just doesn't and gives me the Near "16" syntax error.
View 50 Replies
View Related
Apr 11, 2013
how to give a database connection to a c++ code i am using turbo c++ as an editor and if i have oracle 11g client, odbc as a driver , what else i require and how to link these things in a code.
View 1 Replies
View Related
Apr 22, 2014
I have issues with this i am new to winsock. so i was learning to use winsock for http POST request
Compiles correctly, but doesnt connect i get the error "Connection Failure" what do you think can be wrong
My code goes like this:
Code: #define WIN32_LEAN_AND_MEAN
#include "stdafx.h"
#include <cstdio>
#include <cstdlib>
#include <Winsock2.h>
[Code] .....
View 1 Replies
View Related
Feb 7, 2014
I am designing a server program in C++ and now that everything works for the clients, I would like to implement a command line. The code waits for a connection with the predefined function "new_socket = accept(serversocket,(struct sockaddr *)&client,&addrsize);". I already made a function for the command line but I can't find a way (in my brain or on the web) to accept commands (getline) whilst no connection is accepted yet. (I mean wait for a connection. If no connection, then be ready to receive some arguments from the command line). Here is part of the code:
cout << "Waiting for connection/command...";
command_line_function(); //getline(cin,string)
while(true){
new_socket = accept(serversocket,(struct sockaddr *)&client,&addrsize);
if(new_socket == INVALID_SOCKET){ //INVALID_SOCKET is an error somehow.
error_function();}
cout << "ACCEPTED
";
//etc.
}
View 5 Replies
View Related
Jul 10, 2014
I am currently developing a sync module using asp.net. I am getting data from an external database (mysql database) The problem is I am getting the error "Connection unexpectedly terminated" when filling the dataset.
Here's my code
string P_contact = "SELECT A.id, B.firstname, B.middlename, B.lastname FROM Accounts A, Contacts B WHERE A.id = B.id";
MySqlDataAdapter db_P_contact = new MySqlDataAdapter(P_contact, conn);
DataSet ds3 = new DataSet();
DataTable dt3 = new DataTable();
[Code] ....
I am getting the exception on this line of code:
db_P_contact.Fill(ds3, "P_contact");
View 3 Replies
View Related
Mar 17, 2014
I want to connect an access database (.mdb) to my Windows Forms application - this I can do and I have no problems viewing my table in server explorer.
Some code example or template that I can use as a base to learn from - I have literally trawled Google and Youtube and cannot find what I am after.
What I want to do is have a basic form, 2 text boxes and a button to save the data to my database.
FirstName and LastName are the 2 boxes.
View 6 Replies
View Related
Apr 26, 2014
I have a problem with my C#. Trying to create the airstrip with planes heading out of the hangars and on to the road to the airstrip. Each Hangar pannel is connected with closes road to them. What i am stuck with right now is connecting the roads together so each one of them will see if the next road is free and if it is it will send the plane (colorder square for now) to it and then proceed to the next one when finaly they will line up for the final panel(airstrip) and take off.So far they are just going down the each road they are assigned with semaphore and thread.
using System;
using System.Windows.Forms;
using System.Threading;
using System.ComponentModel;
using System.Collections;
using System.Data;
using System.Drawing;
[Code] ....
Connecting the "p2" with "p5" so the graphics from "p1" the square will travel through P2 and P5 this would be great and will allow me to procede with my studies.
Also i do realise that this might not be the best ways of using concurrent Csharp and not the up to date one but this is what i have been assigned with and do not have any other options unfortunately.
How i understand this is that i need to have 3 buffers and 3 semaphores for each panel. But i do not know how to add those to each one of them and then connect it with the next one as if i try and add them it either puts a cross in the design view over that panel or says that there is limited options for this statement.
This is the way that i want to do it unfortunately it must be so. The most flexible this can be is by adding an array for semaphores and buffer ( do not know how to do that either).
View 7 Replies
View Related
Aug 20, 2013
I was created winform application with sql data base, after i created it i was converted to the installer file,for the other users but when they run the application did not connect to the database, how i fix this stuff...?
View 1 Replies
View Related
Oct 18, 2014
I'm strugling to understand why my app is crashing if there is no internet connection.
Code:
int main() {
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
std::cout << "WSAStartup failed.
[Code] ....
Debug crash code:
Code:
First-chance exception at 0x00161831 in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000C.
Unhandled exception at 0x00161831 in ConsoleApplication1.exe: 0xC0000005: Access violation reading location 0x0000000C.
It works well as long as the computer is connected to internet but if i disconect from internet the application crash but don't understand why.
View 4 Replies
View Related
Mar 27, 2014
I want make connection between access 2013 and visual studio 2010(c#) but the error below is displaying
View 7 Replies
View Related
Nov 29, 2014
What happens if I make a server application using tcp protocol and then establish connection with a client application but the server crash and then the client send data. Will the data be lost or the system will continue trying to send it?
View 2 Replies
View Related
Jan 21, 2015
I got a little question about getting the data path of my c program. I heard something like it's already given in the "int main(int argc, char **argv)". But with witch function can I get it?
For example: The program is called Pathfinder and the path is 'D:Path1Path2Pathfinder.exe'.
View 3 Replies
View Related