473,387 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Unable to connect to a remote database through ASP. NET Hosting

I have a ASP.NET website and an hosting account on asphostportal.com.

I created a SQL Server Database with Direct Access and updated the connection string with the one provided by asphostportal.

There are no errors, but I see no data being stored in the database on a form submit.

Code to insert a row is as follows:

Expand|Select|Wrap|Line Numbers
  1. public int run_sql(string msg)
  2. {
  3.     SqlConnection conn = new SqlConnection();
  4.     SqlCommand cmd = new SqlCommand();
  5.     SqlDataAdapter da = new SqlDataAdapter();
  6.     DataSet ds = new DataSet();
  7.     conn.ConnectionString = connString;
  8.     cmd = conn.CreateCommand();
  9.     cmd.CommandText = msg;
  10.     conn.Open();
  11.     cmd.ExecuteNonQuery();
  12.     conn.Close();
  13.     return 1;
  14.  
  15. }

What could be the issue?
Apr 17 '15 #1
3 1880
The best way to troubleshoot this is by putting it in a try catch block. In case of any errors, log them. If there are no errors, check you connection string, where is it pointing to?

Try going around it. Manually add dummy data and try to retrieve it. If it works then try running the query in msg variable directly in query analyser or something to see if the query is actually working.

If all is well then it should work.
Apr 21 '15 #2
Ok thanks, I'll try it.
Apr 21 '15 #3
Please be advised that you need to use correct connection string. Please kindly ask your hosting provider about the correct connection string that you need to use
Apr 22 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: NagaKiran | last post by:
Hi I need a help. I have a VB code In that I want to connect to a remote database thru VB code. Can we connect a Access database which is located in a web server thru VB? If so how can we...
4
by: JIM.H. | last post by:
Hello, My database stays in a remote site and I have access it through VPN. I would like connect my current Windows based Asp.Net application with this database. What are my options? Can I...
3
by: Pakna | last post by:
Hello, I have what may be a beginner's question regarding DB2. How does one access a remote table on a remote database via SQL? What is the command string, is there an equivalent of Oracle...
7
by: Vivek | last post by:
Hi, I want to know if it is possible to load(using the db2load API) into a remote database. By remote database i mean one that i have cataloged. Any parameters that need to be changed ? TIA
10
by: mairhtin o'feannag | last post by:
Hello, I'm having problems connecting to my new v9 db box. The pertinent information is below: DB2_db2inst1 60000/tcp DB2_db2inst1_1 60001/tcp DB2_db2inst1_2 60002/tcp DB2_db2inst1_END...
1
by: mmr315 | last post by:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\databaseconnect.php on line 5 i wrote code like this ...
5
by: Rnt6872 | last post by:
Hello. All, I've been trying to connect to my hosting company's (Go Daddy) remote database. But continuously receive "Server does not allow remote connections". Do I need a open_source...
1
by: sbettadpur | last post by:
hi, i wrote a script in php, to connect remote database server. i am getting the following errors Warning: mysql_connect() : Host 'IPaddress(i changed)' is not allowed to connect to this MySQL...
4
by: Gourk | last post by:
I'm fairly new to the whole MySQL thing, But not new to SQL. So doing most of this was fairly easy, but I have a hosting service with Godaddy.com, and Yes it supports MySQL 5.0 and is installed and...
2
by: munro01 | last post by:
In ASP I am using a DNS-less connection (see code below: with the log in credentials filtered). <% on error resume next dim csmp_conn dim adoRS dim counter
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.