Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts

Friday, March 23, 2012

how to connect MySQL?

A naive question on how to connect MySQL DB from my C# application.
Kindly explain the steps to be taken to communicate with this DB.

Hi,

There're probably multiple ways of doing this, but one could be:

== Get an ODBC driver for MySQL, for instance here: http://dev.mysql.com/downloads/connector/odbc/3.51.html#win32

== Use System.Data.Odbc namespace functions withC#

The latter is nicely explained in MSDN with samples, you shouldn't have any problems getting into it easily. Have you considered using SQL Express instead of MySQL? You might get richer functionality out of the SqlClient.

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||hey!
Thanx for help. I successfully established connection through first method.
The second one I dont have an idea about what namespace is so didn't try to go that way.It would be helpful if you can shed some light on that method or provide some tutorial link.

Also, I have never heard of SQL express. MySQL is available free and being a student thats the best thing for me. Is SQL express free too? I guess it may be since other express editions are free for students. And is there any extra functionality that would entice me to use SQL express?

regarsd
Sumit Dagar.

Wednesday, March 7, 2012

How to compare Binary and Int colns

I need to compare and update a Binary(8) coln with values from an
Int(4) coln. Could someone please explain how to do this..??

thanks
Sunitsjoshi (sjoshi@.ingr.com) writes:
> I need to compare and update a Binary(8) coln with values from an
> Int(4) coln. Could someone please explain how to do this..??

No, because I don't know how you want to compare four bytes with eight.

The standard recommendation is to include:

o CREATE TABLE statemens for your table(s)
o INSERT statements with sample data.
o The desired result given the sample data.

That permits people who tackle your problem to post a tested solution.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||CREATE TABLE [dbo].[COREBaseClass] (
[oid] [uniqueidentifier] NOT NULL ,
[ConditionID] [int] NOT NULL ,
[persistentFlag] [int] NOT NULL ,
[UIDCreator] [uniqueidentifier] NOT NULL ,
[UIDLastModifier] [uniqueidentifier] NOT NULL ,
[DateCreated] [smalldatetime] NOT NULL ,
[DateLastModified] [smalldatetime] NOT NULL ,
[ApprovalStatus] [int] NOT NULL ,
[ApprovalReason] [int] NOT NULL ,
[tsRelations] [int] NOT NULL ,
[ts] [int] NOT NULL
)
CREATE TABLE [dbo].[COREProxy] (
[oid] [uniqueidentifier] NOT NULL ,
[dwProperties] [int] NOT NULL ,
[sourceTimeStamp] [binary] (8) NOT NULL ,
[COREPersistentFlags] [int] NOT NULL ,
[ts] [int] NOT NULL ,
[tsRelations] [int] NOT NULL
)
These are the 2 tables and I need to update COREProxy.sourceTimeStamp
with the value of COREBaseClass.ts wherever they are not the same.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||Sunit Joshi (sjoshi@.ingr.com) writes:
> CREATE TABLE [dbo].[COREBaseClass] (
> [oid] [uniqueidentifier] NOT NULL ,
> [ConditionID] [int] NOT NULL ,
> [persistentFlag] [int] NOT NULL ,
> [UIDCreator] [uniqueidentifier] NOT NULL ,
> [UIDLastModifier] [uniqueidentifier] NOT NULL ,
> [DateCreated] [smalldatetime] NOT NULL ,
> [DateLastModified] [smalldatetime] NOT NULL ,
> [ApprovalStatus] [int] NOT NULL ,
> [ApprovalReason] [int] NOT NULL ,
> [tsRelations] [int] NOT NULL ,
> [ts] [int] NOT NULL
> )
> CREATE TABLE [dbo].[COREProxy] (
> [oid] [uniqueidentifier] NOT NULL ,
> [dwProperties] [int] NOT NULL ,
> [sourceTimeStamp] [binary] (8) NOT NULL ,
> [COREPersistentFlags] [int] NOT NULL ,
> [ts] [int] NOT NULL ,
> [tsRelations] [int] NOT NULL
> )
> These are the 2 tables and I need to update COREProxy.sourceTimeStamp
> with the value of COREBaseClass.ts wherever they are not the same.

But how? If ts is 4711, what do you want in sourceTimeStamp?

0x126700000000000, 0x0000126700000000 or 0x000000000001267?

If the number is 47114711, do you want:

0xE9D702CE00000000, 0x02CEE9D700000000 or 0x0000000002CEE9D7?

In my previous post, I said:

> The standard recommendation is to include:
> o CREATE TABLE statemens for your table(s)
> o INSERT statements with sample data.
> o The desired result given the sample data.
> That permits people who tackle your problem to post a tested solution.

I did not say this only for fun. If you cannot give a good specification
to the problem you have, you will either get no solution at all or

You can say things like:

convert(binary(8), ts) or convert(int, sourceTimeStamp)

But whether this gives you the values you are looking for, I can't
say, because I don't know what you are looking for.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||I would need 0x126700000000000 as below:

thanks
Sunit
---------------
But how? If ts is 4711, what do you want in sourceTimeStamp?

0x126700000000000, 0x0000126700000000 or 0x000000000001267?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||Sunit Joshi (sjoshi@.ingr.com) writes:
> I would need 0x126700000000000 as below:

And what about 47114711?

0xE9D702CE00000000, 0x02CEE9D700000000 or 0x0000000002CEE9D7?

And why do you refuse to post:

> The standard recommendation is to include:
> o INSERT statements with sample data.
> o The desired result given the sample data.

If you are not prepared to put any effort into your problem, why do
you expect someone else to do it?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp