Showing posts with label beginner. Show all posts
Showing posts with label beginner. Show all posts

Monday, March 19, 2012

Connecting to MSDE

Being new to the SQL server world I have a beginner question.

How do I grant access to database from a networked computer?
I have tried:
sp_grantlogin '\\computername\username'
and I get the error:
Windows NT or user <above> not found. Please check name.

Any help would be appreciated.
Thanks
EricEric Borden (borden_eric@.invalid.com) writes:
> Being new to the SQL server world I have a beginner question.
> How do I grant access to database from a networked computer?
> I have tried:
> sp_grantlogin '\\computername\username'
> and I get the error:
> Windows NT or user <above> not found. Please check name.

This not really my area, but I believe that SQL Server needs to be
able to verify that the user exists. If the user is in the same domain
as SQL Server this is trivial. But if all you have a workgroup, and
not a domain, things are getting difficult. In this case, SQL authentication
may be required.

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

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

Sunday, March 11, 2012

Connecting to Database On windows 5.0 CE Device.

I'm a beginner in the Visual Studio Development for Mobile Devices.

I'm trying to develop a small program for a PSC Falcon handheld Scanner.

Particluars are

VS 2005 SP1

SQL Compact Edition

Windows CE 5.0

The test program is just a datagrid viewing data from the database

when the form loads with the following code:

Me.TblDetailsTableAdapter.Fill(Me.Test3DataSet.tblDetails)

trapping the error I get

Error Code: 8007000E

Message :

Minor Code:0

Source : SQL Server Compact Edition ADO.NET Data Provider

The interesting thing is that if I have the Database open in Query Analyzer 3.0.

The program works fine.

Maybe this is relevant: SqlCeCommand objects are not automatically disposed if you use a SqlCeDataAdapter object

http://support.microsoft.com/default.aspx/kb/824462

|||

Thanks for the timely response.

Being under a ending time schedule.

I went in a different direction to collect the scanned data.

Collecting in a Dataset and writing to a txt file.

I'll keep this in mind for future development.

Saturday, February 25, 2012

Connecting SQL Clustering from 2 different sites

Hi all.. hope someone can help me on this.. I'm a beginner and have
limited knowledge on clustering.
I managed to setup 2 set active/passive cluster with SQL clustering on
2 different site which is connected through lease line.
Plant 1:
Cluster IP : 192.168.128.150
SQL Cluster IP: 192.168.128.200 (VIRTUSQLS1)
Node1: 192.168.128.10
Node2: 192.168.128.11
Plant 2:
Cluster IP: 192.168.128.2.150
SQL Cluster IP: 192.168.2.200 (VIRTUALSQLS2)
Node1: 192.168.2.10
Node2: 192.168.2.11
A few questions here:
1. Why all nodes in Plant 2 can ping all the nodes/cluster/sqlcluster
in Plant 1 but Plant 2 can ping all nodes in Plant 1 except the
cluster/sqlcluster? There are 3 NIC in each node where there are
Gateways set in 2 of the NIC except for the heartbeat connection. Is
there anything to do with routing?
2. We have a software where we need to transfer data from SQL in Plant
2 to Plant 1 or vice versa. How do we define the Host? By the IP ( I
don't know how I can make the server in Plant 1 to recognise the name
VIRTUALSQLS2)?
Your help is very much appreaciated. Thanks
sw.yin
They are on two different subnets. Plant 1 is on the 192.168.128 subnet and
Plant 2 is on the 192.168.2 subnet.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Edwin vMierlo [MVP]" <EdwinvMierlo@.discussions.microsoft.com> wrote in
message news:unCXSN$3HHA.948@.TK2MSFTNGP06.phx.gbl...
in-line
<subscrib3@.gmail.com> wrote in message
news:1187258221.606896.189050@.z24g2000prh.googlegr oups.com...
> Hi all.. hope someone can help me on this.. I'm a beginner and have
> limited knowledge on clustering.
> I managed to setup 2 set active/passive cluster with SQL clustering on
> 2 different site which is connected through lease line.
> Plant 1:
> Cluster IP : 192.168.128.150
> SQL Cluster IP: 192.168.128.200 (VIRTUSQLS1)
> Node1: 192.168.128.10
> Node2: 192.168.128.11
> Plant 2:
> Cluster IP: 192.168.128.2.150
> SQL Cluster IP: 192.168.2.200 (VIRTUALSQLS2)
> Node1: 192.168.2.10
> Node2: 192.168.2.11
> A few questions here:
> 1. Why all nodes in Plant 2 can ping all the nodes/cluster/sqlcluster
> in Plant 1 but Plant 2 can ping all nodes in Plant 1 except the
> cluster/sqlcluster? There are 3 NIC in each node where there are
> Gateways set in 2 of the NIC except for the heartbeat connection. Is
> there anything to do with routing?
your cluster IP in plant 2 is on the same subnet as your cluster IP in plant
1, are you sure you are tunneling/vlanning this subnet accross ? also you
made a typo above, please send us the correct settings. Furthermore, check
if your private network in plant 2, you might be mistakingly routing packets
there (do not use a Default GW on your private NIC's, you should only have 1
NIC with a default GW), as well as check subnetting of your private NIC's.

> 2. We have a software where we need to transfer data from SQL in Plant
> 2 to Plant 1 or vice versa. How do we define the Host? By the IP ( I
> don't know how I can make the server in Plant 1 to recognise the name
> VIRTUALSQLS2)?
SQL2005 supports logshipping, various forms of replication, as well as
database mirroring... would that do what your want ?
If not give us more info on your requirements, or the package/software you
are planning of using
HTH,
Edwin.
|||Sorry, it was a typo. The correct one should be:
Plant 1:
Cluster IP : 192.168.128.150
SQL Cluster IP: 192.168.128.200 (VIRTUSQLS1)
Node1: 192.168.128.10
Node2: 192.168.128.11
Plant 2:
Cluster IP: 192.168.2.150
SQL Cluster IP: 192.168.2.200 (VIRTUALSQLS2)
Node1: 192.168.2.10
Node2: 192.168.2.11
No, there is no Default Gateway set on the Private network only the
public network. I will double-check again on the subnetting.
2. I have our own customised software where it will do some processing
and transfer some data over from Plant 1 to Plant 2. In the software,
we definately need to define the Host or the SQL Server in Plant 2 in
order for me to access it. Do I connect it by IP or what must I do in
Plant 1 for it to recognize the name VIRTUALSQLS2?
Thanks all for the answer. I will do further checking and update
later.
sw.yin
On Aug 16, 6:50 pm, "Edwin vMierlo [MVP]"
<EdwinvMie...@.discussions.microsoft.com> wrote:
> in-line
> <subscr...@.gmail.com> wrote in message
> news:1187258221.606896.189050@.z24g2000prh.googlegr oups.com...
>
>
>
>
>
> your cluster IP in plant 2 is on the same subnet as your cluster IP in plant
> 1, are you sure you are tunneling/vlanning this subnet accross ? also you
> made a typo above, please send us the correct settings. Furthermore, check
> if your private network in plant 2, you might be mistakingly routing packets
> there (do not use a Default GW on your private NIC's, you should only have 1
> NIC with a default GW), as well as check subnetting of your private NIC's.
>
>
> SQL2005 supports logshipping, various forms of replication, as well as
> database mirroring... would that do what your want ?
> If not give us more info on your requirements, or the package/software you
> are planning of using
> HTH,
> Edwin.- Hide quoted text -
> - Show quoted text -
|||BTW, each node have 3 NICs. 1 NIC for the heartbeat connect with the
IP of 10.x.x.x. No Default GW defined here. The other 2 NIC is public
NIC with Default Gateway defined for both of it.
sw.yin
On Aug 16, 8:16 pm, "Edwin vMierlo [MVP]"
<EdwinvMie...@.discussions.microsoft.com> wrote:
> In that case, I suspect that packets are mis-routed due to 2 NIC's having
> Default GW's configured.
> "Tom Moreau" <t...@.dont.spam.me.cips.ca> wrote in message
> news:O5Fkqb$3HHA.4476@.TK2MSFTNGP06.phx.gbl...
>
> and
>
>
>
>
>
> plant
> packets
> 1
>
>
> - Show quoted text -
|||Even though you have two public NICs on each server, we see only one IP per
node and per virtual SQL Server. How is the second NIC configured?
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"sw.yin" <subscrib3@.gmail.com> wrote in message
news:1187266752.154718.149560@.g12g2000prg.googlegr oups.com...
Sorry, it was a typo. The correct one should be:
Plant 1:
Cluster IP : 192.168.128.150
SQL Cluster IP: 192.168.128.200 (VIRTUSQLS1)
Node1: 192.168.128.10
Node2: 192.168.128.11
Plant 2:
Cluster IP: 192.168.2.150
SQL Cluster IP: 192.168.2.200 (VIRTUALSQLS2)
Node1: 192.168.2.10
Node2: 192.168.2.11
No, there is no Default Gateway set on the Private network only the
public network. I will double-check again on the subnetting.
2. I have our own customised software where it will do some processing
and transfer some data over from Plant 1 to Plant 2. In the software,
we definately need to define the Host or the SQL Server in Plant 2 in
order for me to access it. Do I connect it by IP or what must I do in
Plant 1 for it to recognize the name VIRTUALSQLS2?
Thanks all for the answer. I will do further checking and update
later.
sw.yin
On Aug 16, 6:50 pm, "Edwin vMierlo [MVP]"
<EdwinvMie...@.discussions.microsoft.com> wrote:
> in-line
> <subscr...@.gmail.com> wrote in message
> news:1187258221.606896.189050@.z24g2000prh.googlegr oups.com...
>
>
>
>
>
> your cluster IP in plant 2 is on the same subnet as your cluster IP in
> plant
> 1, are you sure you are tunneling/vlanning this subnet accross ? also you
> made a typo above, please send us the correct settings. Furthermore, check
> if your private network in plant 2, you might be mistakingly routing
> packets
> there (do not use a Default GW on your private NIC's, you should only have
> 1
> NIC with a default GW), as well as check subnetting of your private NIC's.
>
>
> SQL2005 supports logshipping, various forms of replication, as well as
> database mirroring... would that do what your want ?
> If not give us more info on your requirements, or the package/software you
> are planning of using
> HTH,
> Edwin.- Hide quoted text -
> - Show quoted text -

Tuesday, February 14, 2012

Connect to the DB?

Hi,

I am a beginner in asp.net so sorry for my question ..

I want to make the event for the button when clicked , inside this event I will be transfer the value of dropdownlist into the DB by use ( WHERE ) condition ..

My question is :

- how I write the connection to the DB ?? is this a connection statement in the web.config ?? or what ?? because it generate an error by this code..

SqlConnection sqlConnection1 =new System.Data.SqlClient.SqlConnection("Data Source=-\SQLEXPRESS;Initial Catalog=2C2Mdb;Integrated Security=True");

SqlCommand cmd =newSqlCommand();

cmd.CommandType = System.Data.CommandType.Text;cmd.CommandText ="INSERT Meeting (mSessionNO) VALUES (" + DropDownList2.selectedvalue +") WHERE [HijriYear]=" + DropDownList1.SelectedValue ;

cmd.Connection = sqlConnection1;

sqlConnection1.Open();

cmd.ExecuteNonQuery ();

sqlConnection1.Close();

What is the proplem ?

There are a few things with the code

Add the @. symbol in front of the string so that it escapes the escape characters. \ is an escape character in C#

SqlConnection sqlConnection1 =new System.Data.SqlClient.SqlConnection(@."Data Source=-\SQLEXPRESS;Initial Catalog=2C2Mdb;Integrated Security=True");

You need to put quotes around your dropdownlist values

cmd.CommandType = System.Data.CommandType.Text;cmd.CommandText ="INSERT Meeting (mSessionNO) VALUES (' " + DropDownList2.selectedvalue +"') WHERE [HijriYear]='" + DropDownList1.SelectedValue +" ' ";

|||

Hi Sofy,

Everything seems correct except your ConnectionString.

Try this

SqlConnection sqlConnection1 =new System.Data.SqlClient.SqlConnection("Data Source=(local)\SQLEXPRESS;Initial Catalog=2C2Mdb;Integrated Security=True");

Let me know if it works

Regards

|||

Thaaaanks for all replies ...