Showing posts with label connect. Show all posts
Showing posts with label connect. Show all posts

Thursday, March 29, 2012

Change local connection string on remote server

Hello,

I have searched every post and tried every connection string there but can't figure out how to connect to my database on my remote server. I am using Visual Developer 2005 Express Edition in C# and uploading it to a Windows server running asp.net 2.0. The domain has not resolved yet.

I am so new to this and have followed many tutorials step by step but none of them address this issue. They just show how to upload it to the server.

Do I need to use the SQL server provided by my host or can the database stay in the App_Data folder?

My local connection string works locally:

<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\add_newSQL.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />

When I uploaded to my server I changed \SQLEXPRESS to (local) as advised in the forum.

<add name="ConnectionString" connectionString="Data Source=(local);AttachDbFilename=|DataDirectory|\add_newSQL.mdf;Integrated Security=True;User Instance=True"

providerName="System.Data.SqlClient" />

When I debug a page I get the <customErrors mode="Off"/>
error message even thought I have already set it in my remote web.config file which may be causing problems itself:

<configuration>

<appSettings/>

<connectionStrings>

<add name="ConnectionString" connectionString="Data Source=(local);AttachDbFilename=|DataDirectory|\add_newSQL.mdf;Integrated Security=True;User Instance=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

<system.web>

<customErrors mode="Off" />

<compilation debug="false" />

<authentication mode="Windows" />

</system.web>

</configuration>

Thanks for any help you can offer. I wish I could find someone to hire to do this part for me or teach me how over the phone. Any suggestions?

You are running SQL Express on your development system (your local computer). Are you running SQL Express on the web server?

Thanks,
Bryan

|||Having this same, problem!!!!!|||So the same question to you, as the question wasn′t answered by the original poster, are you running SQL Server Express on the WebServer ?

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Sunday, March 25, 2012

Change existing application to use sqlncli

I have a large application that currently uses SQLOLEDB as the provider.
The application needs to connect to SQL 7 thru SQL 2005.
I have tested changing the provider to SQLNCLI and everything still seems to
work.
I have a couple of questions ..
1) Is it really this easy ?
2) Can I still connect to SQL 7 and SQL 2000 using SQLNCLI ?
3) Are there any negative impacts to using SQLNCLI ?
Thanks.
The whole idea behind SQLNCLI is to provide updated capability to existing
ADO classic (COM-based) applications. I understand that it's supposed to
work with older versions, but if history is any teacher, I would thoroughly
test before betting my socks on it. See
http://blogs.msdn.com/dataaccess/archive/2005/07/29/445147.aspx for more
info.
Frankly, I would think (hard) about migrating to ADO.NET and the SqlClient
provider that can reach all current (and future?) versions of SQL
Server--and a lot faster with fewer surprises.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"Michael Tissington" <mtissington@.newsgroup.nospam> wrote in message
news:OOhR4DSXHHA.1636@.TK2MSFTNGP02.phx.gbl...
>I have a large application that currently uses SQLOLEDB as the provider.
> The application needs to connect to SQL 7 thru SQL 2005.
> I have tested changing the provider to SQLNCLI and everything still seems
> to work.
> I have a couple of questions ..
> 1) Is it really this easy ?
> 2) Can I still connect to SQL 7 and SQL 2000 using SQLNCLI ?
> 3) Are there any negative impacts to using SQLNCLI ?
> Thanks.
>

Change existing application to use sqlncli

I have a large application that currently uses SQLOLEDB as the provider.
The application needs to connect to SQL 7 thru SQL 2005.
I have tested changing the provider to SQLNCLI and everything still seems to
work.
I have a couple of questions ..
1) Is it really this easy ?
2) Can I still connect to SQL 7 and SQL 2000 using SQLNCLI ?
3) Are there any negative impacts to using SQLNCLI ?
Thanks.
The whole idea behind SQLNCLI is to provide updated capability to existing
ADO classic (COM-based) applications. I understand that it's supposed to
work with older versions, but if history is any teacher, I would thoroughly
test before betting my socks on it. See
http://blogs.msdn.com/dataaccess/archive/2005/07/29/445147.aspx for more
info.
Frankly, I would think (hard) about migrating to ADO.NET and the SqlClient
provider that can reach all current (and future?) versions of SQL
Server--and a lot faster with fewer surprises.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"Michael Tissington" <mtissington@.newsgroup.nospam> wrote in message
news:OOhR4DSXHHA.1636@.TK2MSFTNGP02.phx.gbl...
>I have a large application that currently uses SQLOLEDB as the provider.
> The application needs to connect to SQL 7 thru SQL 2005.
> I have tested changing the provider to SQLNCLI and everything still seems
> to work.
> I have a couple of questions ..
> 1) Is it really this easy ?
> 2) Can I still connect to SQL 7 and SQL 2000 using SQLNCLI ?
> 3) Are there any negative impacts to using SQLNCLI ?
> Thanks.
>
|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Change existing application to use sqlncli

I have a large application that currently uses SQLOLEDB as the provider.
The application needs to connect to SQL 7 thru SQL 2005.
I have tested changing the provider to SQLNCLI and everything still seems to
work.
I have a couple of questions ..
1) Is it really this easy ?
2) Can I still connect to SQL 7 and SQL 2000 using SQLNCLI ?
3) Are there any negative impacts to using SQLNCLI ?
Thanks.The whole idea behind SQLNCLI is to provide updated capability to existing
ADO classic (COM-based) applications. I understand that it's supposed to
work with older versions, but if history is any teacher, I would thoroughly
test before betting my socks on it. See
http://blogs.msdn.com/dataaccess/ar.../29/445147.aspx for more
info.
Frankly, I would think (hard) about migrating to ADO.NET and the SqlClient
provider that can reach all current (and future?) versions of SQL
Server--and a lot faster with fewer surprises.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"Michael Tissington" <mtissington@.newsgroup.nospam> wrote in message
news:OOhR4DSXHHA.1636@.TK2MSFTNGP02.phx.gbl...
>I have a large application that currently uses SQLOLEDB as the provider.
> The application needs to connect to SQL 7 thru SQL 2005.
> I have tested changing the provider to SQLNCLI and everything still seems
> to work.
> I have a couple of questions ..
> 1) Is it really this easy ?
> 2) Can I still connect to SQL 7 and SQL 2000 using SQLNCLI ?
> 3) Are there any negative impacts to using SQLNCLI ?
> Thanks.
>|||Hi ,
How is everything going? Please feel free to let me know if you need any
assistance.
Sincerely,
Wei Lu
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.

Tuesday, March 20, 2012

Change datasource location

All my reports are using odbc connection to connect to database.
Anytime database server is changed I have to manually update the
datasource in each report. My question is there a better way to do
this?
Thanks in Advance,
Bhavnawhat version of crystal u r using?

Using front end interface u can set datasource..|||I am using crystal 10. I know how to update datasource in the report. What I would like to know how to update all the reports datasource at one time instead of opening up each report and changing the datasource.

Thanks!sql

Sunday, February 19, 2012

CDBVariant

Hi

got small problem. I got three rows in a table

Index (int)
Product (varchar)
Price (float)

I could successfully connect to the database. I also get the values and store them in a CDBVariant type. I can't put the values into List Control Box... insertItem always return -1. It ask for LPCTSTR type.

Anyone can help me please, hanging around here know for hours?

Please
Thx

CODE

{
CDBVariant value;
char sql_statement [2048] = "";

//CDatabase object "db" created to connect database
CDatabase db;
db.OpenEx(_T("DSN=Beauty"),CDatabase::noOdbcDialog);

//CRecordset object "rs" created to access and manipulate database records.
CRecordset rs(&db);
strcpy(sql_statement,_T("SELECT * FROM TestTabelle"));
rs.Open(CRecordset::forwardOnly,sql_statement);

//Get quantity from Database
int n = rs.GetODBCFieldCount( );

while(!rs.IsEOF())
{
for( int i = 0; i < n; i++ )

{

rs.GetFieldValue("index",value);
m_Buy_List.InsertItem(i,LPCTSTR(value.m_lVal)); Won't work at all

rs.GetFieldValue("product",value.m_pstring);
m_Buy_List.SetItemText(i,2,LPCTSTR(value));Getting weird String for example "Soap" and ListBox shows "Aq3"

rs.GetFieldValue("price",value);
m_Buy_List.SetItemText(i,3,LPCTSTR(value.m_fltVal) ); Won't accept float

rs.MoveNext( );
}
}Perhaps you would get better results on a C++ forum...

If you know that the values must be strings, and you are retrieving each one explicitly, why not just create three variables (strings), and use those. Seems like it would be a lot easier and less trouble prone.

If you are concerned about NULLs (which you should be), change your SQL statement to use the ISNULL function on each of the fields you are dealing with:

SELECT ISNULL(index,0) AS INDEX, ISNULL(product,'') AS PRODUCT, ISNULL(price,0) AS PRICE FROM TestTabelle|||thx

i figured another way out... getFieldValue isn't accepting strings so i converted them in char :)

weird... someday i will find the official way... i will change it then :)

iam new into c++ and ms sql... learning by doing :)