Showing posts with label linking. Show all posts
Showing posts with label linking. Show all posts

Friday, March 30, 2012

Ms SQL7 linking problem

i have tried linking all my aspx scripts with ms access, they all worked,now i have switched on to ms sql7...iam not familier with the codes used for sql...my main problem is the data source syntax...in case of access i had given the file address along with extension...eg: C:\Data\Nortwind.mdb...so what should i do in case of sql... i have also given my code below

sub Page_load(sender as object, E as eventargs)

dim objconnection As sqlconnection
dim objcommand as sqlCommand
dim objadapter as sqlDataAdapter
dim objdata As DataSet
dim strsearch as String
dim sqlquery as String

strsearch = tb1.text

if Len(trim(strSearch))>0 then

objConnection = new sqlconnection("Data Source=(localhost);")

sqlquery= "select * from mayank where (name"&strsearch.ToString()&")"

objcommand = new sqlcommand(sqlquery, objconnection)

objadapter = new sqlDataAdapter(objcommand)

objdata = new DataSet()
objadapter.Fill(objdata)

DataGrid1.DataSource = objdata

DataGrid1.DataBind()

objConnection.close

Else
tb1.text= "enter your search here"
end if
end sub


Checkwww.connectionstrings.com

Regards

Monday, March 12, 2012

MS SQL Linked Servers(Linking MySQL to MS SQL) Collation problem.

Hello,
I have a problem. I've linked MySql server to MsSql, in MySql I have a
table with Latvian data(character set is ucs2, ucs2_general_ci) and
the problem is that when I use openquery to read data from MySQL
server, some characters are not translated correctly! I receive
question symbols instead of Latvian special characters.
Maybe someone had this kind of problem with collation?P?vels Mihailovs (iceravenlv@.gmail.com) writes:

Quote:

Originally Posted by

I have a problem. I've linked MySql server to MsSql, in MySql I have a
table with Latvian data(character set is ucs2, ucs2_general_ci) and
the problem is that when I use openquery to read data from MySQL
server, some characters are not translated correctly! I receive
question symbols instead of Latvian special characters.
Maybe someone had this kind of problem with collation?


Since I don't work with MySQL myself, it's difficult to say what is
going on. But if MySQL has a notion of collation, and the collation is
ucs2_general_ci, it sounds like MySQL returns Unicode data. One would
expect that to arrive unscathed. What is you collation on the SQL
Server side?

The stored procedure sp_serveroption permits you to set options for
linked servers, and two of them relates to collations. You could play
around with these and see what happens. Please look in Books Online
for details.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Jun 22, 1:16 am, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

P?vels Mihailovs (icerave...@.gmail.com) writes:

Quote:

Originally Posted by

I have a problem. I've linked MySql server to MsSql, in MySql I have a
table with Latvian data(character set is ucs2, ucs2_general_ci) and
the problem is that when I use openquery to read data from MySQL
server, some characters are not translated correctly! I receive
question symbols instead of Latvian special characters.
Maybe someone had this kind of problem with collation?


>
Since I don't work with MySQL myself, it's difficult to say what is
going on. But if MySQL has a notion of collation, and the collation is
ucs2_general_ci, it sounds like MySQL returns Unicode data. One would
expect that to arrive unscathed. What is you collation on the SQL
Server side?
>
The stored procedure sp_serveroption permits you to set options for
linked servers, and two of them relates to collations. You could play
around with these and see what happens. Please look in Books Online
for details.
>
--
Erland Sommarskog, SQL Server MVP, esq...@.sommarskog.se
>
Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


on the MS SQL server i'm using Latvian_CI_AI, but some databases are
set to Latvian_CI_AS collation (sorry db admin can't explain why they
are using it).
I've tried using different collation option, I've checked all 1257 and
other collation, but result was almost the same. :/