C# :: Null Reference With Connection String

Nov 29, 2014

private DataSet1 GetData(string query) {
string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;

The above is erring out with NullReferenceException

View 6 Replies


ADVERTISEMENT

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 View Related

C# :: How To Parse Information Into A Connection String For EF (Oracle Db)

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

C Sharp :: SQL Server Connection String To Connect Through Domain Name (internet)

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

C# :: While Statement Not Recognizing Non-null String

Oct 10, 2014

The List[] array contains some empty entries but most are filled, yet every time I run this routine the variable Index makes it to the end of the array. I've tried many different routes and can't seem to figure out this simple issue.

string Result = string.Empty;
while ((Index < (List.Length - 1)) || !string.IsNullOrEmpty(Result))
{
Result = List[Index];
Index++;
}
return Result;

View 9 Replies View Related

C/C++ :: Null Terminated String Function

Feb 12, 2015

how would I write a function that copies a null-terminated string from one char* buffer to another, without using strcpy? I am trying to avoid strcpy because of the null terminator.

Here is my attempt;

#include <algorithm>
#include <iostream>
static const size_t, data_size =32;
struct tString
{
char data[data_size];
};
std::string buffer = strArray1[0] + strArray2[0];
std::copy(buffer.begin(), buffer.end(), tString[0].data);

View 8 Replies View Related

C/C++ :: Why Is String Null Terminating Character Actually Needed

Dec 26, 2014

I know that the null at the end of the string indicates end of that string but why is it actually needed. Strings in C are just arrays of char variables. A "Hello" string would be stored in ascii code as:

char string[] = {72, 101, 108, 108, 111, 0}

When I have array of integers like

int intArray[] = {72, 101, 108, 108, 111}

I can perform various operations with it like comparision with other array etc. but I don't need terminating character

View 6 Replies View Related

C++ :: Null Terminator Same As Null And Through False Value?

Feb 18, 2014

I am looking at one of the functions of an exercise:

void escape(char * s, char * t) {
int i, j;
i = j = 0;
while ( t[i] ) {
/* Translate the special character, if we have one */
switch( t[i] ) {

[code]...

Notice the while loop evaluates the current value in t to true or false. When we hit the null terminator, does that get evaluated as 0 and hence evaluates as a falsy value so the while loop exits?

View 1 Replies View Related

C++ :: Passing String Using Reference Operator

Aug 28, 2014

Why it is necessary to use the reference operator here ?

const string& content() const {return data;}

Example in [URL] ....

// classes and default constructors
#include <iostream>
#include <string>
using namespace std;

class Example3 {
string data;

[Code] .....

View 2 Replies View Related

C++ :: Reference To A String In Function Parameters

Feb 22, 2015

So I was reading my book and it listed this piece of code. The first piece of code is in the book and the 2nd is just my test on the piece of code. I am curious as to why in the functions parameters there is a reference to aString. I've noticed that removing it has no affect on the outcome of the code.

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool isPalindrome (string & aString) {

[Code] ....

View 2 Replies View Related

C# :: Get The Actual String Passed By Reference?

Apr 8, 2015

I have a list of Strings that are passed to a method consecutively by reference from a class. I want to get the string value passed to the method at a point in time. The reason is to perform an if statement.

//this is the class that holds that holds the constants.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace xxx.Functional.xyz.Login {
public class Constants {
public static String Username = "paul";
public static String Code = "4";

[code].....

View 2 Replies View Related

C++ :: Converting Reference Address To Character String

Jun 15, 2014

I'm wanting to convert the reference address held by a pointer into a character string, combine the hexes into a single unsigned long int(using bitwise operators )so I can use the 32bits in conjunction with a separate algorithm to develop a more efficient, but less 'random', number, or should I say bit, generator that I'll be using in a Neural Network, with Genetic Algorithms used to modify the weights.

View 5 Replies View Related

C++ :: Explicit Conversion From String To Class Reference?

May 10, 2013

following code that I'm reading out of the book "The C++ Standard Library".

class C
{
public:
explicit C(const std::string & s); // explicit(!) type conversion from strings.
...

[Code].....

Now I understand that they are saying that an explicit conversion isn't allowed but what I don't understand is what explicit conversion would be happening if there was one allowed.

Specifically I don't understand the const C & elem syntax. How does this work since the collection holds strings. What would be the syntax for how this:

const C & elem

gets strings. I was thinking it was a class reference that someone how converts to a constructor function pointer or something but i'm really confused.

View 4 Replies View Related

C# :: Session Is Null But Not Null?

Mar 31, 2015

When you login to my site my loginservice which is done by ajax and json make a session called context.Session["Name"]. With BreakPoints it shows that everything is good and the variables are in place. However when I use Session["Name"] it comes out as null.

I will add my code at the bottem not

using System;
using System.Collections.Generic;
using System.Linq;

[Code].....

View 2 Replies View Related

C# :: How To Disable And Enable LAN Connection In WPF

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

C :: Getting Input From A Serial Connection (Hyperterminal)

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

C# :: Reconnecting To Internet If Connection Drops

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

C Sharp :: Could Not Open Connection To SQL Server

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

C++ :: How To Give Database Connection To Code

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

C++ :: HTTP POST Request - Connection Failure

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

C++ :: Command Line And Waiting For A Connection (Socket)

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

C# :: MySQL Exception Connection Unexpectedly Terminated

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

C# :: Access Database Connection And Saving Data

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

C# :: Concurrent Sharp Panel Connection With Semaphores And Buffers

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

C Sharp :: Winform Installer Error From Database Connection

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

C++ :: Windows Socket Makes App Crash If No Internet Connection

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







Copyrights 2005-15 www.BigResource.com, All rights reserved