Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Sunday, March 11, 2012

connecting to dbf

Hi,

I am having trouble connecting to a dbf file inside an SSIS package. How do I connect to a dbf file in SSIS.

Thanks

Brian

Check out the discussion @. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=228933&SiteID=1

Thanks,
Loonysan

Wednesday, March 7, 2012

connecting to 2 databases inside one query

hi there,
I saw a similar thread before but i've tried it and no luck. I want run a query off a database (stawebdata.branchinfo) then a join into bluepages.phonelist

i've tired

JOIN bluepages.phonelist p

Incorrect syntax near the keyword 'JOIN'.

any ideas... is this possible?

complete code below:

select DISTINCT b.name, b.tel1, b.id, b.telprivate,b.sc, b.manager,b.branchEmail
from branchInfo b
inner
JOIN bluepages.phonelist p on b.name = p.subdepartment
where b.name like 'Sarah' or b.id LIKE '%@.keyword%' OR b.county LIKE '%@.keyword%' OR b.Area LIKE '%@.keyword%' OR b.Manager LIKE '%@.keyword%' OR b.AssistantManager LIKE '%@.keyword%' OR b.Postcode LIKE '%@.keyword%' OR b.PseudoCity LIKE '%@.keyword%' OR b.TicketingTA LIKE '%@.keyword%' OR b.SLC LIKE '%@.keyword%' OR b.ItineraryTA LIKE '%@.keyword%' OR b.TIDS LIKE '%@.keyword%' OR b.ABTA LIKE '%@.keyword%' and
p.department = 'UK Branch' and
b.isbranch <> 'False' or
(p.lastName = '@.keyword' or p.firstname = '@.keyword')
order by b.name asc
GOyou have to put

JOIN bluepages.dbo.phonelist

i thought "dbo" was a param!

derrr|||How about putting two dots:

JOIN bluepages..phonelist

Roshmi Choudhury

Connecting through VPN fails

Hi all!
At work, I've no problems connecting to our testserver. From home I have
problems. I use VPN to get inside our firewall, and everything else works as
expected. Whether I try to connect to my testdata from my application, or I
try to connect using SQL Query Analyzer, I get the same errormessage (pasted
in here):
Unable to connect to server OSS24DBTEST:
ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
The servers is set up to use both Sql server and Windows authentication.
Anyone that have a clue where to start?
I'm a newbe using SQL server 2000
Thanks
AT
Hi,
Hope you have solved it in the meantime.
I do the same with a Checkpoint VPN connection over ADSL and this works well.
Will a straight (no VPN) connection work? (Use port 1433/1434). Be sure to
have this port open.
If this works, try to see if there is a portblocking vehickle at the other
side in the VPN router, if this is OK you really have a problem.
Besides, I was pleasantly surprised with the speed of the results working
over VPN.
I saw no degradation in performance with the direct connection.
Good luck,
"A.Taurus" wrote:

> Hi all!
> At work, I've no problems connecting to our testserver. From home I have
> problems. I use VPN to get inside our firewall, and everything else works as
> expected. Whether I try to connect to my testdata from my application, or I
> try to connect using SQL Query Analyzer, I get the same errormessage (pasted
> in here):
> Unable to connect to server OSS24DBTEST:
> ODBC: Msg 0, Level 16, State 1
> [Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
> The servers is set up to use both Sql server and Windows authentication.
> Anyone that have a clue where to start?
> I'm a newbe using SQL server 2000
> Thanks
> AT
>
>

Connecting through VPN fails

Hi all!
At work, I've no problems connecting to our testserver. From home I have
problems. I use VPN to get inside our firewall, and everything else works as
expected. Whether I try to connect to my testdata from my application, or I
try to connect using SQL Query Analyzer, I get the same errormessage (pasted
in here):
Unable to connect to server OSS24DBTEST:
ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
The servers is set up to use both Sql server and Windows authentication.
Anyone that have a clue where to start?
I'm a newbe using SQL server 2000
Thanks
AT
When you use VPN, you log onto the domain from home, right? Otherwise, it
won't work.
When I use VPN, I often Remote Desktop into a machine at the office, and log
onto the domain there.
Jeff
"A.Taurus" <nospam@.spam.no> wrote in message
news:cl6d9f$slu$1@.services.kq.no...
> Hi all!
> At work, I've no problems connecting to our testserver. From home I have
> problems. I use VPN to get inside our firewall, and everything else works
as
> expected. Whether I try to connect to my testdata from my application, or
I
> try to connect using SQL Query Analyzer, I get the same errormessage
(pasted
> in here):
> Unable to connect to server OSS24DBTEST:
> ODBC: Msg 0, Level 16, State 1
> [Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
> The servers is set up to use both Sql server and Windows authentication.
> Anyone that have a clue where to start?
> I'm a newbe using SQL server 2000
> Thanks
> AT
>
>

Saturday, February 25, 2012

Connecting through VPN fails

Hi all!
At work, I've no problems connecting to our testserver. From home I have
problems. I use VPN to get inside our firewall, and everything else works as
expected. Whether I try to connect to my testdata from my application, or I
try to connect using SQL Query Analyzer, I get the same errormessage (pasted
in here):
Unable to connect to server OSS24DBTEST:
ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
The servers is set up to use both Sql server and Windows authentication.
Anyone that have a clue where to start?
I'm a newbe using SQL server 2000
Thanks
ATWhen you use VPN, you log onto the domain from home, right? Otherwise, it
won't work.
When I use VPN, I often Remote Desktop into a machine at the office, and log
onto the domain there.
Jeff
"A.Taurus" <nospam@.spam.no> wrote in message
news:cl6d9f$slu$1@.services.kq.no...
> Hi all!
> At work, I've no problems connecting to our testserver. From home I have
> problems. I use VPN to get inside our firewall, and everything else works
as
> expected. Whether I try to connect to my testdata from my application, or
I
> try to connect using SQL Query Analyzer, I get the same errormessage
(pasted
> in here):
> Unable to connect to server OSS24DBTEST:
> ODBC: Msg 0, Level 16, State 1
> [Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
> The servers is set up to use both Sql server and Windows authentication.
> Anyone that have a clue where to start?
> I'm a newbe using SQL server 2000
> Thanks
> AT
>
>

Connecting through VPN fails

Hi all!
At work, I've no problems connecting to our testserver. From home I have
problems. I use VPN to get inside our firewall, and everything else works as
expected. Whether I try to connect to my testdata from my application, or I
try to connect using SQL Query Analyzer, I get the same errormessage (pasted
in here):
Unable to connect to server OSS24DBTEST:
ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
The servers is set up to use both Sql server and Windows authentication.
Anyone that have a clue where to start?
I'm a newbe using SQL server 2000
Thanks
ATHi,
Hope you have solved it in the meantime.
I do the same with a Checkpoint VPN connection over ADSL and this works well
.
Will a straight (no VPN) connection work? (Use port 1433/1434). Be sure to
have this port open.
If this works, try to see if there is a portblocking vehickle at the other
side in the VPN router, if this is OK you really have a problem.
Besides, I was pleasantly surprised with the speed of the results working
over VPN.
I saw no degradation in performance with the direct connection.
Good luck,
"A.Taurus" wrote:

> Hi all!
> At work, I've no problems connecting to our testserver. From home I have
> problems. I use VPN to get inside our firewall, and everything else works
as
> expected. Whether I try to connect to my testdata from my application, or
I
> try to connect using SQL Query Analyzer, I get the same errormessage (past
ed
> in here):
> Unable to connect to server OSS24DBTEST:
> ODBC: Msg 0, Level 16, State 1
> [Microsoft][ODBC SQL Server Driver]Cannot generate SSPI context
> The servers is set up to use both Sql server and Windows authentication.
> Anyone that have a clue where to start?
> I'm a newbe using SQL server 2000
> Thanks
> AT
>
>

Friday, February 17, 2012

Connecting as a different user in a script

Is there a way to connect as a different user inside of a
script or SP? If so, could someone tell me the syntax (T-
SQL)? With that, I'd need to know how to disconnect or
close that connection and go back to the original
connection that ran the script.
Thanks,
VanUsername or login?
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Van Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:070c01c3c320$b7479f40$a501280a@.phx.gbl...
> Is there a way to connect as a different user inside of a
> script or SP? If so, could someone tell me the syntax (T-
> SQL)? With that, I'd need to know how to disconnect or
> close that connection and go back to the original
> connection that ran the script.
> Thanks,
> Van|||SQL Login. Connect as a different sql login from a script
or sp....
>--Original Message--
>Username or login?
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Van Jones" <anonymous@.discussions.microsoft.com> wrote
in message
>news:070c01c3c320$b7479f40$a501280a@.phx.gbl...
>> Is there a way to connect as a different user inside of
a
>> script or SP? If so, could someone tell me the syntax
(T-
>> SQL)? With that, I'd need to know how to disconnect or
>> close that connection and go back to the original
>> connection that ran the script.
>> Thanks,
>> Van
>
>.
>|||For SQL Login, you can use xp_cmdshell which kicks off OSQL and use the appropriate user in the /U
script.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Van Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:1436a01c3c327$010a50e0$a601280a@.phx.gbl...
> SQL Login. Connect as a different sql login from a script
> or sp....
> >--Original Message--
> >Username or login?
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at:
> >http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Van Jones" <anonymous@.discussions.microsoft.com> wrote
> in message
> >news:070c01c3c320$b7479f40$a501280a@.phx.gbl...
> >> Is there a way to connect as a different user inside of
> a
> >> script or SP? If so, could someone tell me the syntax
> (T-
> >> SQL)? With that, I'd need to know how to disconnect or
> >> close that connection and go back to the original
> >> connection that ran the script.
> >>
> >> Thanks,
> >>
> >> Van
> >
> >
> >.
> >

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 ...