Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Friday, March 30, 2012

How Can I Rename a Reportin Service Folder using Code

Using Reporting Service Web service

It is possible to create folder and delete folder. But I couldn't rename the folder using code it tried with setProperties method but name is ready only property. Please help me to resolve the issue.

Thanks in Advance.

Krishna kumar.M

hi all,

Later I found if use the rs.MoveItem we can achive the same

sql

Wednesday, March 28, 2012

How can I remote my sql server?

How do I get access to my server.
It keeps saying this.
I set yes to tcp
What port is it suposto be on?

Code Snippet

TITLE: Connect to Server

Cannot connect to gv.ns1.name.


ADDITIONAL INFORMATION:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=53&LinkId=20476


BUTTONS:

OK

Verify that you have followed all the steps in these articles.

Configuration -Configure SQL Server 2005 to allow remote connections
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277
http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

Configuration -Connect to SQL Express from "downlevel clients"
http://blogs.msdn.com/sqlexpress/archive/2004/07/23/192044.aspx

Configuration -Connect to SQL Express and ‘Stay Connected’
http://betav.com/blog/billva/2006/06/getting_and_staying_connected.html

Configuration - Guideline for Connectivity Question Posting
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=362498&SiteID=1

|||Where is an FAQ I wrote on troubleshooting connection problems to SQL Server http://www.tek-tips.com/faqs.cfm?fid=5481|||I can't connect even to localhost.
So it has nothing to do with firewall.
Something in setting but i have no clue about this....|||Verify that the SQL Server is actually running. Check in the Services applet.|||I can connect though the computer.
Not though remote though.|||

So, if you can connect through the local computer, and not the remote computer, and you are certain that the configurations for remote connections are set correctly,

... and you say that you

can't connect even to localhost

what computer are you attempting to connect to remotely. (Clue: The remote computer is NOT known as 'localhost'.)

Please post your entire connection string.

|||Did you edit your lmhosts or hosts file? Doing remote connections, you need to resolve the IP address into a name.|||

Can you verify that you followed the instructions in this posting. Quick check list:

Make sure that TCP/IP is enabled for the instance (Use SQL Server Configuration Manager) If using a named instance, make sure that the SQL Server Browser server is running (Use SQL Server Configuration Manager) If using a named instance and you're running a firewall, make sure sqlservr.exe and sqlbrowser are added to the exception list.

Friday, March 23, 2012

How can I Port Driver and OAL code of Windows CE 5.0 to Windows CE 4.2

How can I Port Driver and OAL code of Windows CE 5.0 to Windows CE 4.2?

If anybody have idea about this, kindly give me suggestions.

I think you are posting to the wrong forum. This is T-SQL forum...sql

How can i only get people which is brithday is today?

Why i got "SqlException was unhandled by user code" "{"Incorrect syntax near '12'."}" ?

How can i only get people which is brithday is today?

The "rc_brithday" datatype is datetime

Thanks you

Code is below:

cmdSelect = New SqlCommand("Select rc_email From recruiters WHERE rc_brithday = " & DateTime.Now(), conPubs)
conPubs.Open()
dtrTitles = cmdSelect.ExecuteReader()

himap:

Code is below:

cmdSelect = New SqlCommand("Select rc_email From recruiters WHERE rc_brithday = " & DateTime.Now(), conPubs)

Change the above line to - (I highlighted the single quote in red to make the line easier to read)

cmdSelect = New SqlCommand("Select rc_email From recruiters WHERE rc_brithday ='" & DateTime.Now() & "'", conPubs)

|||

hoopslife:

himap:

Code is below:

cmdSelect = New SqlCommand("Select rc_email From recruiters WHERE rc_brithday = " & DateTime.Now(), conPubs)

Change the above line to - (I highlighted the single quote in red to make the line easier to read)

cmdSelect = New SqlCommand("Select rc_email From recruiters WHERE rc_brithday ='" & DateTime.Now() & "'", conPubs)

I have no error now, but therc_brithdayinclude the time, so no any data is get from sql server.

How can i except the time that only focue the date find people birthday is today? THANKS YOU

i use follow statement is no error butno any data is get from sql server, why?:

cmdSelect = New SqlCommand("Select rc_email,rc_brithday From recruiters WHERE rc_brithday = '" & DateTime.Now().ToString("d") & "'", conPubs)

|||Use

DateTime.Now.ToShortDateString()

|||cmdSelect = New SqlCommand("Select rc_email,rc_birthday From recruiters WHERE rc_birthday>=dateadd(d,0,datediff(d,0,getdate())) AND rc_birthday<dateadd(d,1,datediff(d,0,getdate()))", conPubs) |||

Motley:

cmdSelect = New SqlCommand("Select rc_email,rc_birthday From recruiters WHERE rc_birthday>=dateadd(d,0,datediff(d,0,getdate())) AND rc_birthday<dateadd(d,1,datediff(d,0,getdate()))", conPubs)

this solution is work!! thanks you very much!!!

I also change to more simple solution, have same work result,

cmdSelect = New SqlCommand("Select rc_email,rc_birthday From recruiters WHERE rc_birthday>=dateadd(d,0,datediff(d,0,getdate())) AND rc_birthday<dateadd(d,1,datediff(d,0,getdate()))", conPubs)

or

cmdSelect = New SqlCommand("Select rc_email,rc_birthday From recruiters WHERE rc_birthday=dateadd(d,0,datediff(d,0,getdate()))", conPubs)

or

cmdSelect = New SqlCommand("Select rc_email,rc_birthday From recruiters WHERE rc_birthday=datediff(d,0,getdate())", conPubs)

Monday, March 19, 2012

How Can I make conect with sql server

In this code, I don′t know what is wrong.

<%

Set conexao = Server.CreateObject("ADODB.Connection")
stringconexao = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=username;Password=password;Initial Catalog=GeoSite;sdb=geocontrol;Data Source=128.2.1.158"
' Abro a conex?o
conexao.open(stringconexao)
dim mat
mat=1

sql= "insert into sscusuar(cdmatricu,email) values ('"&mat&"','"&Request.form("cemail")&"')"
conexao.execute(sql)
%>

___________________
Edited by moderator SomeNewKid
Removed login credentials.

What is the error that you are getting?|||thanks, for your help, but now I know the number of ip was worg, sorry for make you to lose time,

Wednesday, March 7, 2012

How can I have table and column definitions?

Hi,
I want to develop a code generator for our Data-Access Layer and I'd like to
know if there are queries I can make to have the table and column
definitions... something like Select * From Tables and Select * From
Columns Where TableName=@.TableName... something like this... I know there
are views in SqlServer 2005... for the Table Definition, I think it's
INFORMATION_TABLES or something like it... there is a similar table for
columns, but some properties are missing, like if the columns is an
Identity...
I also want to know if there is a way to retrieve the relationships like
Table1.Field1-->Table2.Field2 or something like this...
If you have a link to a web site I can find all those informations, go ahead
and post it... ;) but for those who would be tempted, don't post
www.google.com, I already tried to find something useful without any real
success...
Can someone help me please?
Thanks
ThunderMusic
Now don't go off and 'reinvent the wheel'.
Try these articles:
http://www.theserverside.net/tt/articles/showarticle.tss?id=DataSetDesigner
http://www.codegeneration.net/tiki-index.php?page=NET
http://www.codegeneration.net/generators.php
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"ThunderMusic" <NoSpAmdanlatathotmaildotcom@.NoSpAm.com> wrote in message
news:u6BSHIYFHHA.1240@.TK2MSFTNGP03.phx.gbl...
> Hi,
> I want to develop a code generator for our Data-Access Layer and I'd like
> to know if there are queries I can make to have the table and column
> definitions... something like Select * From Tables and Select * From
> Columns Where TableName=@.TableName... something like this... I know
> there are views in SqlServer 2005... for the Table Definition, I think
> it's INFORMATION_TABLES or something like it... there is a similar table
> for columns, but some properties are missing, like if the columns is an
> Identity...
> I also want to know if there is a way to retrieve the relationships like
> Table1.Field1-->Table2.Field2 or something like this...
> If you have a link to a web site I can find all those informations, go
> ahead and post it... ;) but for those who would be tempted, don't post
> www.google.com, I already tried to find something useful without any real
> success...
> Can someone help me please?
> Thanks
> ThunderMusic
>
|||because I want to add my own things in it... and because we will probably
generate 100's of classes, I don't want to cut and paste my things in all
these classes... with my code generator, I'll be sure the classes reflect
exactly what we really need.
thanks tought, those links may be helpful...
ThunderMusic
"Arnie Rowland" <arnie@.1568.com> wrote in message
news:OtThwNYFHHA.5000@.TK2MSFTNGP03.phx.gbl...
> Now don't go off and 'reinvent the wheel'.
> Try these articles:
> http://www.theserverside.net/tt/articles/showarticle.tss?id=DataSetDesigner
> http://www.codegeneration.net/tiki-index.php?page=NET
> http://www.codegeneration.net/generators.php
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
> You can't help someone get up a hill without getting a little closer to
> the top yourself.
> - H. Norman Schwarzkopf
>
> "ThunderMusic" <NoSpAmdanlatathotmaildotcom@.NoSpAm.com> wrote in message
> news:u6BSHIYFHHA.1240@.TK2MSFTNGP03.phx.gbl...
>
|||I thought the links might give you ideas, if not even code...
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"ThunderMusic" <NoSpAmdanlatathotmaildotcom@.NoSpAm.com> wrote in message
news:u2BNr6YFHHA.1784@.TK2MSFTNGP06.phx.gbl...
> because I want to add my own things in it... and because we will probably
> generate 100's of classes, I don't want to cut and paste my things in all
> these classes... with my code generator, I'll be sure the classes reflect
> exactly what we really need.
> thanks tought, those links may be helpful...
> ThunderMusic
>
> "Arnie Rowland" <arnie@.1568.com> wrote in message
> news:OtThwNYFHHA.5000@.TK2MSFTNGP03.phx.gbl...
>

Monday, February 27, 2012

How can I get the package name within a script?

Greetings,

I need to programmatically grab the name of the executing package so that it can be used in logging. Does someone have a code sample for this?

Thanks!

Use the system variable, PackageName.|||

Thanks.

For those who may benefit from a code sample:

Dim source AsString

Dim vars As Variables

Dts.VariableDispenser.LockOneForRead("System:Stick out tongueackageName", vars)

source = vars("PackageName").Value.ToString()

|||Also the other options (perhaps not for this example) are to use a derived column to add the system variable to the data flow, or in the control flow, using an Execute SQL task, you can map the variable to a parameter in the SQL statement.

Sunday, February 19, 2012

How can i get a return code of 1 for an osql command which has a lower severity..

I am running the following OSQL command and capturing the return code
for the error .Whenver i have an error like server not exists or uable
to login I get a return code of 1 for the %ERRORLEVEL%.However
whenever I have an errorof a wrong dbcompatibility error the retun
code id 1 even though sql returns an iformation message from OSQL that
the right copatibilty levels are 60,70 and 80.How can i get OSQL to
return the right return code whenver a error of this type occurrs from
batch mode sql.The OSQL i am running from the batch is

osql -S%SrvName% -U%Username% -P%Userpswd% -n -w 132 -d%DBname%
-Q%sqlcmd% -o%Dirrpt%\%DBname%_%SPname%.txt
ECHO %errorlevel% >> %logbatch%
IF %ERRORLEVEL% NEQ 0 Goto SQLError

sqlcms is exec sp_dbcompatibiltylevel srvrname, dbname 80

Thanks in anticipation.

Ajay[posted and mailed, please reply in news]

Ajay Garg (ajayz90@.hotmail.com) writes:
> I am running the following OSQL command and capturing the return code
> for the error .Whenver i have an error like server not exists or uable
> to login I get a return code of 1 for the %ERRORLEVEL%.However
> whenever I have an errorof a wrong dbcompatibility error the retun
> code id 1 even though sql returns an iformation message from OSQL that
> the right copatibilty levels are 60,70 and 80.How can i get OSQL to
> return the right return code whenver a error of this type occurrs from
> batch mode sql.The OSQL i am running from the batch is
> osql -S%SrvName% -U%Username% -P%Userpswd% -n -w 132 -d%DBname%
> -Q%sqlcmd% -o%Dirrpt%\%DBname%_%SPname%.txt
> ECHO %errorlevel% >> %logbatch%
> IF %ERRORLEVEL% NEQ 0 Goto SQLError
> sqlcms is exec sp_dbcompatibiltylevel srvrname, dbname 80

Here is a simple example that illustrates:

E:\temp>osql -E -n -Q "EXIT (SELECT 47)"

----
47

(1 row affected)

E:\temp>echo %ERRORLEVEL%
47

E:\temp
By putting the entire SQL batch within EXIT(), OSQL will return the
value of the last result set to the command-line environment.

For details, see the topic on OSQL in Books Online.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns9402EF532A497Yazorman@.127.0.0.1>...
> [posted and mailed, please reply in news]
> Ajay Garg (ajayz90@.hotmail.com) writes:
> > I am running the following OSQL command and capturing the return code
> > for the error .Whenver i have an error like server not exists or uable
> > to login I get a return code of 1 for the %ERRORLEVEL%.However
> > whenever I have an errorof a wrong dbcompatibility error the retun
> > code id 1 even though sql returns an iformation message from OSQL that
> > the right copatibilty levels are 60,70 and 80.How can i get OSQL to
> > return the right return code whenver a error of this type occurrs from
> > batch mode sql.The OSQL i am running from the batch is
> > osql -S%SrvName% -U%Username% -P%Userpswd% -n -w 132 -d%DBname%
> > -Q%sqlcmd% -o%Dirrpt%\%DBname%_%SPname%.txt
> > ECHO %errorlevel% >> %logbatch%
> > IF %ERRORLEVEL% NEQ 0 Goto SQLError
> > sqlcms is exec sp_dbcompatibiltylevel srvrname, dbname 80
> Here is a simple example that illustrates:
> E:\temp>osql -E -n -Q "EXIT (SELECT 47)"
> ----
> 47
> (1 row affected)
> E:\temp>echo %ERRORLEVEL%
> 47
> E:\temp>
> By putting the entire SQL batch within EXIT(), OSQL will return the
> value of the last result set to the command-line environment.
> For details, see the topic on OSQL in Books Online.

I noticed someting even more interesting.Even though the return code
was 0
when there was an error the job on sql server which actually failed
showed that it ran sucessfully.Even though when i run the job as an
Xp_cmdshell command on the sql server it shows that it failed what
could be the reason that it behaves that way?

Thanks in anticipation.

Ajay|||Ajay Garg (ajayz90@.hotmail.com) writes:
> I noticed someting even more interesting.Even though the return code
> was 0
> when there was an error the job on sql server which actually failed
> showed that it ran sucessfully.Even though when i run the job as an
> Xp_cmdshell command on the sql server it shows that it failed what
> could be the reason that it behaves that way?

I'm sorry, but I don't follow. Could you clarify with an example?

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

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