Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Friday, March 30, 2012

relationships problem

VB.NET 05 (ADO.NET) / SQL SERVER 05.
i have a many-to-many relationship. therefore, according to the normalisation theory, i introduced a new table which acts as a link between them.

1) tblOrders
PK: orderID

2) tblOrdersItems
FK: orderID
FK: itemID

3) tblItems
PK: itemID

the user wishes to view the details of a particular order which should include all the items
contained withing that particular order.

question: what is the technique to be used in order to get this done?

i) dim varOrderID as integer
ii) select tblOrdersItems.itemID where orderID = varOrderID
iii) HOW TO NOW FETCH the details of the items contained in this order from tblItems which should be displayed on a datagrid?

I believe you could use query similar to

SELECT list of field here From TblItems I INNER JOIN tblOrdersItems OI ON I.itemID=OI.itemID

WHERE OI.orderID=MyIDHere

|||

You can use the following query,

Code Snippet

Select * from tblOrders A

Join tblOrdersItems B on A.orderId = b.orderId

Join tblItems C on C.itemId = B.ItemId

Where

A.orderId = @.YourOrderId

sql

Monday, March 26, 2012

Relational database

Hi

I'm using VB.NET,ADO.NET in ASP.NET .

Microsoft .Net framework 1.0

Windows 2000

Visual Studio IDE

and SQLServer.

I have to create to tables as

Table1 contains ID,Name

Table2 contains ID,Marks,Foreign Key ie Primary key of the table Table1.

Give me an information how to create these two tables in SQLServer (I know how to create a table but i don't know how to create a table which includes Foreign Key.)

Then using Dataset i want to display the records as Name,Marks which are stored in two tables.

I have studied that in ADO Join query and record set object is used but it gives a problems and it is not good when we want to transfer the data between two applications or pages but dataset solves all those problems.

Give me an information about it.

Kindly help me

Thanks in advance

Regards.

To create table with Foreign key constraint using T-SQL:

create table tbl_PK (ID int primary key,name varchar(30))
go
create table tbl_FK (ID int foreign key REFERENCES tbl_PK(ID),
Marks varchar(50))

To get the joined result:


select p.name,f.marks from tbl_PK p join tbl_FK f
on p.ID=f.ID

|||

Hi

What you have given is also a join query.but i have studied that no need of join query in case of dataset but it is required for record set.

Thanks

|||To do that, please take a look a the following short movie:

http://msdn.microsoft.com/vstudio/express/media/en/AbsoluteBeginner/vb/08VB.wvx

This is tutorial movie about VWD 2005 and SQL server EE, I believe you can also apply it to VS 2005 because the similarity.

Basically what you do is you create database diagram with right clickon 'Database Diagram' under the Database explorer of your databasefilename. Then add new diagram. After that you can add all your tables,then drag the primary key to create the foreign key.

hope this will help.

Wednesday, March 21, 2012

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,
Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/default...b;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>
sql

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,
If you remove and then re-install MSDTC, you may need to restart SQL Server
for it to be able to use it. MSDTC has to be running when SQL Server starts
or it cannot use it. I am not sure this will resolve the problem, but I
would stop MSDTC and SQL Server. Then start MSDTC and verify that it is
running. Then start SQL Server.
Rand
This posting is provided "as is" with no warranties and confers no rights.
|||Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/default...b;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/default.aspx?scid=kb;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,If you remove and then re-install MSDTC, you may need to restart SQL Server
for it to be able to use it. MSDTC has to be running when SQL Server starts
or it cannot use it. I am not sure this will resolve the problem, but I
would stop MSDTC and SQL Server. Then start MSDTC and verify that it is
running. Then start SQL Server.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/defaul...kb;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Reinstalling MS DTC

Here I go for last time, I promise.
I uninstalled MS DTC (in an stupid attemp to avoid a distributed transaction
to start), by doing :
net stop MSDTC
MSDTC - uninstall
After some charitative aim told me what I wanted to do is not possible, I
decided to reinstall :
MSDTC -install
net start MSDTC
I can see the "Distributed Transaction Coordinator" item, in the service
manager, it is running for sure.
Also, the Services console shows it as "started".
But I still getting the message MSDTC on server 'myserver' is unavailable'.
I've repeated the operation a couple of times, to be sure (deinstall and
reinstall) and still not working.
Actually, I recall yesterday I was able to stop and restart MSDTC without
problem, several times, but I was just doing that : stop & restart.
Today it happens that I "uninstall" it and then it is not like before any
more.
I'm using an account with Administrator privilegies (Windows 2000 Advanced
Server / SQL Server 2000 Enterprise)
Is there something else I need to do to ? should I need to restart the SQL
Server ? SQL Agent ?
Any help is greatly appreciated.
Regards,Refer to the following MSKB article:
How To Reinstall MS DTC for a Nonclustered Windows 2000 Server
http://support.microsoft.com/defaul...kb;EN-US;279786
Michael D. Long
Microsoft MVP - Windows SDK
"Craig Kenisston" <craigkenisston@.hotmail.com> wrote in message
news:%23c9KX9IhEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Here I go for last time, I promise.
> I uninstalled MS DTC (in an stupid attemp to avoid a distributed
transaction
> to start), by doing :
> net stop MSDTC
> MSDTC - uninstall
>
> After some charitative aim told me what I wanted to do is not possible, I
> decided to reinstall :
> MSDTC -install
> net start MSDTC
> I can see the "Distributed Transaction Coordinator" item, in the service
> manager, it is running for sure.
> Also, the Services console shows it as "started".
> But I still getting the message MSDTC on server 'myserver' is
unavailable'.
> I've repeated the operation a couple of times, to be sure (deinstall and
> reinstall) and still not working.
> Actually, I recall yesterday I was able to stop and restart MSDTC without
> problem, several times, but I was just doing that : stop & restart.
> Today it happens that I "uninstall" it and then it is not like before any
> more.
> I'm using an account with Administrator privilegies (Windows 2000 Advanced
> Server / SQL Server 2000 Enterprise)
> Is there something else I need to do to ? should I need to restart the SQL
> Server ? SQL Agent ?
> Any help is greatly appreciated.
>
> Regards,
>

Tuesday, March 20, 2012

Reinitializing SQL Server 2005 CE subscriber results in a hang

I'm having an issue when I'm using merge replication between SQL Server 2000
sp4 and .NET client using SQL Server 2005 Compact Edition (v3.1). The client
is based on the sample code from MSDN library listed on the
SQLCeReplication.BeginReplication page that fires events to show each stage
of replication that happens.
The inital snapshot is pulled down and the database is created successfully.
When I change data in the SQL Server 2000 database, subsequent replications
work ok and the client successfully pulls down the changes.
However, when the subscription is reinitialized (either at the server, or
client), the app hangs. I believe it may be to do with the size of the
database as it works fine with smaller subsets of the data.
In my case, the app successfully completes the inital conversation with SQL
Server 2000 (the OnSynchronization event reports that SyncProgres is 100%)
and the PublisherChanges property says that there are over 2,000,000 changes
to be made. With an empty database, the app goes on to download each
published table in turn. However, when the subscription is marked for
reinitialization, the app just seems to hang - CPU is up to 90-95% and the
local database grows by 50% but then it does not seem to go any further.
Is this a known limitation with SQL Server 2005 CE? Are there any
workarounds, eg so can I identify in advance whether my subscription has been
marked for reinialization, so that I can drop my existing subscription
(deleting the database) and recreate it again using the latest snapshot?
Thanks
Stuart
Hi,
From your description, I understand that after your subscription was
initialized your application hanged. You would like to know if this was a
known limitation with SQL Server 2005 CE or if you can know in advance that
your subscription is in re-initialization.
If I have misunderstood, please let me know.
From my research, there is not a known limitation regarding this issue. We
can query its status via the stored procedure sp_helpmergesubscription,
however it cannot be judged whether or not a subscription is in
reinitializing. You may check whether or not this issue also occurs on
other subscribers with other SQL Server 2005 Editions.
Anyway I will try to consult the product team on this issue to get further
suggestions. Also I appreciate your understanding that this issue seems was
performance related. To track the root cause and workaround this issue,
dump analysis may be required, however this work can only be done by
Microsoft Customer Support Services (CSS). If I could not get an effective
answer from product team, effectively and immediately I recommend that you
contact CSS via telephone so that a dedicated Support Professional can
assist you in a more efficient manner. Please be advised that contacting
phone support will be a charged call.
To obtain the phone numbers for specific technology request please take a
look at the web site listed below.
http://support.microsoft.com/default.aspx?scid=fh;EN-US;PHONENUMBERS
If you are outside the US please see http://support.microsoft.com for
regional support phone numbers.
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== ====
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
|||Hi Stuart,
This is a quick note to let you know that I have not got the response from
the product team. I will try to follow up them now. However since the
process may need a long time, I recommend that you leave me
(changliw_at_microsoft_dot_com) an email response so that I can timely
update you when I got the response. If this issue is urgent to your
business, I recommend that you contact CSS via telephone for the best
support.
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Monday, February 20, 2012

Registering a SQL Server Instance

Ok, well I just installed Visual Studio.NET 2003 on my PC, and toprepare for next years courses I thought I might get going on some ofthe exercises. But I am rather new to this and when I try to expand"SQL Server" in the "Server Explorer Window" I get this message.
Could not automaticly discover any SQL Server instances.
Choose Register SQL Server instance from the shortcut menu if you know there are SQL Server instances on this machine.

From there all I know is that I can right click on "SQL Server" andchose register new instance, but I do not know what to enter, and itsuggrests leaving it balck but that doesn't work. I will get aninstance but when I try to expand it another error pops up.
So as you can see I have no idea what I am doing when it comes to SQL Server, can any one help me with this?
Thanks again,
MCCCStudentTry either (local) WITH the parentheses, or the name of your computer.
|||I have tried the name of my computer and then i just tried (local), andlocal, and then when I try an expand it, it brings up the "SQL ServerLogin Window" with Administrator in the login name so i typed in myadmin password and this error poped up
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied.
|||Is the SQL Server service running?
|||If you right-click on the Server Group instance in Enterprise Manager,select 'properties' then click on the Connection tab, what method ofAuthentication is selected?
Tryst
|||Thanks guys my problems are solved

register sql server

Hi,
Iam learning asp.net myself .
I've installed SQL Server7.0 in my PC.
How will I register a server
for example: localhost using enterprise manager.
I keep getting error message:
Specified SQL Server not found

Please help with registering a server.

Thanks
Abi.Can you confirm the SQL Server service is running?

register online sql server

Hi, here is my problem

I am trying to conncet to an SQL Server that is on the net. The name of the server looks like : sqlServer.TheCompanyOwingIt.Com and it listens to port 2433

I am opening enterprise manager and trying to connect ,giving the name of the server and the credentials but no luck. I also tried opening hte client Network utility , created an alias for that server, specifying 2433 as the port but no luck again. Finally i tried to change the port of my sql server to be 2433 (instead of 1433), no luck again !!! Any ideas ? (there is no firewall running on the PC, but there is a router which might (?) cause the problem ? (i tried to port forward 2433 , but i am not sure if i did it correctly).

Any ideas, suggestions will be greatly appreciated

Thx in advance

Theodore

Did you use the syntax of

sqlServer.TheCompanyOwingIt.Com,2433

?

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Use it where ?

someplace in the enterprise manager? no, not really, i havent used it. Could u plz be more specific on the steps i have to follow?

thx

theodore

|||

Navigate to a group

New registration > Type in ServerName,portnumber e.g. JensOne,2222 > Next > Security information > Next > Next > Finish

Done :-)

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

ok...

that didnt work either !!! i guess there might be a problem with my pc or my ISP ?.... i'll figure it out somehowSmile

thx anyway Jens;-)