|
Programmer. wrote: Is it possible connect to a remote sql server for test a program on the net or know?
Yes, it it possible until you have server IP, Username, Password and Database
|
|
|
|
|
If there are firewalls between the client and the server (and most likely there is), you must have an open port for the conversation.
It may be that you have to have a secure connection to the firewall first and after that the port the sql server is listening is seen as open. After that, it's just a normal connection.
|
|
|
|
|
hi
i am currently using MS SQL and have a window form connecting thru a database remotely thru a static IP(though i am doing it locally now to try)
i would like to know how can i store my user password and username as my window form need to be able to log in and out
currently i connect thru to my database thru
SqlConnection
and open the connection however i am needed to create a user on the security of the ms sql database and map it to my database.
which means that my sql connection statment is currently having a userid and password
is it possible to set the ms sql database or the windowform to loginto the ms sql server and authenticate thru a table in the selected database
|
|
|
|
|
neodeaths wrote: i would like to know how can i store my user password and username as my window form need to be able to log in and out
If you don't ask the user for the password or username could you simply use integrated security (Windows authentication mode).
neodeaths wrote: i am needed to create a user on the security of the ms sql database and map it to my database
This can be done with both Windows authentication mode and SQL Server authentication mode.
neodeaths wrote: is it possible to set the ms sql database or the windowform to loginto the ms sql server and authenticate thru a table
No, to gain access to a table you need to logon first.
|
|
|
|
|
table name trips
starttime endtime triptime Stoprate
14/08/2008 10:39:00 PM 14/08/2008 10:56:00 PM 16 3
14/08/2008 10:59:00 PM 14/08/2008 11:1:00 PM 2
i want the sql queries to create stoprte value
Ahmed El-Badry
|
|
|
|
|
Ahmed El-Badry wrote: i want the sql queries to create stoprte value
Could you be more specific what you're trying to achieve? You want to calculate stoprate value with what kind of formula?
|
|
|
|
|
i want calculate stoprate value
table name trips
starttime endtime triptime Stoprate
14/08/2008 10:39:00 PM 14/08/2008 10:56:00 PM 16 3
14/08/2008 10:59:00 PM 14/08/2008 11:1:00 PM 2
stop value = 14/08/2008 10:56:00 PM - 14/08/2008 10:59:00 PM = 3
i want the sql queries to calculate stoprte value
Ahmed El-Badry
|
|
|
|
|
So the stoprate is endtime from row 1 - starttime from row 2 in minutes? If that's correct, you could use something like:
select datediff(minute,
trips.endtime,
(select min(t2.starttime)
from trips t2
where t2.starttime > trips.endtime))
from trips...
|
|
|
|
|
thnx i will tray it
Ahmed El-Badry
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hi friends,
I am working with SQL Server 2005 database with Collation selected as Chinese_PRC_CI_AS
I have a table DMASTER in the database with a field called DNAME of type VARCHAR(254) which contains some Chinese characters.
When i run a query like
select * from dmaster where DNAME = N'翻译文字或网页翻译文字或网页';
from the SQL Server 2005 client, it works fine.
But if I try the same query programmatically using API "SQLExecDirect", it returns no records.
May I know the problem and how to solve it.
Thank you
cheers
Varghese Paul
|
|
|
|
|
|
Thank you. It worked fine.
cheers
Varghese Paul
|
|
|
|
|
|
HI!!
I have a table (sqlserver2005)
ID-------date1--------date2
1--------1/12/2008-----30/5/2009
2--------1/12/2009-----30/6/2010
...
I typed a date in a textbox.
I need to select ID as that date will be between date1 and date2.
How can i do that thanks.
exemple whene date=30/2/2009 id is 1.
Thanks!
modified on Tuesday, January 6, 2009 4:57 AM
|
|
|
|
|
You can use between operator like:
SELECT ...
FROM ...
WHERE DateFromTextBox BETWEEN date1 AND date2
|
|
|
|
|
HI!!
I did this :
String rqtr2 = "select ID as [p1] from Table where ('" + TextBox2.Text + "' between date1 and date2)";
and
TextBox2.Text = Convert.ToString(DateTime.Now) ;
but it is not right .
Help me please!
thanks
|
|
|
|
|
foryou wrote: but it is not right
What do you mean by that? Could you post an example row and what you entered in the textbox. That would clarify your problem. The forst guess would be that when you convert the date to a string, it isn't in a format that the db understands.
Little off-topic: it's a bad habit to use literals in the sql statement. Use parameters instead.
modified on Wednesday, January 7, 2009 7:27 AM
|
|
|
|
|
Hi!
Merci Mika Wendelius
sorry I dont speak English well.
what I am in the textbox is the system date (detetime)
example :
07/01/2009 11:59:16
Little off-topic: it's a bad habit to use literals in the sql statement. Use parameters instead.
I do not know how to use parameters in this case.
Thanks!!
|
|
|
|
|
foryou wrote: sorry I dont speak English well
No problem at all
foryou wrote: what I am in the textbox is the system date (detetime)
example :
07/01/2009 11:59:16
ok, you may encounter a conversion problem. If you're using literals (which I do not encourage at all) you would have a query like
select ...
from ...
where CONVERT(datetime, '07/01/2009 11:59:16', 101) between date1 and date2
You can test this for example like this:
select *
from sysobjects
where CONVERT(datetime, '01/07/2009 11:59:16',101) -- now
between GETDATE()-1 -- yesterday
and GETDATE()+1 -- tomorrow
Notice that the format is mm/dd/yyyy. if you want to use dd/mm/yyyy, you should use British/French format:
CONVERT(datetime, '07/01/2009 11:59:16', 103)
However you won't have these problems at all if you use parameters. Then your query would look like
select ...
from ...
where @SomeDateParameter between date1 and date2
There are good examples in BOL: SqlParameter[^].
foryou wrote: Merci Mika Wendelius
Ne rien. (I hope it was correct )
|
|
|
|
|
Hi!!
Thank you very much Mika Wendelius! it works.
Mika Wendelius wrote
Ne rien. (I hope it was correct )
they say "De rien".
|
|
|
|
|
foryou wrote: Thank you very much
You're welcome
foryou wrote: they say "De rien".
I had a feeling it was wrong. Thanks for correcting! It's been over 20 years I studied french and never used it after that so I guess I have forgotten about everything
|
|
|
|
|
Hi all
How to get LSN detail of a Log backup in sql server?
Thanks.,
Willington
D.Willington
|
|
|
|
|
|
we dont want to restore the log backup..,
Please tell me, how to get LSN withot restoring..
Thanks.,
Willington
D.Willington
|
|
|
|