Showing posts with label aspnet. Show all posts
Showing posts with label aspnet. Show all posts

Monday, March 12, 2012

how to call sql store procedure in asp.net

I create a store procedure in sql, how do I call it?

thankssUse SqlCommand like this:

YourCommandName = New SQLCommand("YourStoredProcedureHere",YourConnection)
YourCommandName.CommandType = CommandType.StoredProcedure
You can also add parameters to the SqlCommand.|||got it.

thankss

Friday, March 9, 2012

how to call IFilters in ASP.NET

Hello friends i need to extract the content before its gets uploaded to
a BLOB Field in my database. Now I tried using OFFICE XP PIA'S. but due
to license issues and other technical difficulties and other reasons, i
had to abandon that idea, Now i have to use IFilters and I cant get any
idea as to where to start from and where to end. I have learned the
structure of the Ifilters but i am not able to implement well for my
web based application I urgently require help...
Thanks in advance
Kunal Ramesh Lalwani
Software Developer
Fahm Softwares
India
Filtdump -b Mydoc.doc > Mydoc.txt work well. You mgiht want to talk to your
MS sales folks about licensing issues about using this in production.
What sort of docs are you converting however?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<kunallalwani@.gmail.com> wrote in message
news:1129281908.857040.187530@.g43g2000cwa.googlegr oups.com...
> Hello friends i need to extract the content before its gets uploaded to
> a BLOB Field in my database. Now I tried using OFFICE XP PIA'S. but due
> to license issues and other technical difficulties and other reasons, i
> had to abandon that idea, Now i have to use IFilters and I cant get any
> idea as to where to start from and where to end. I have learned the
> structure of the Ifilters but i am not able to implement well for my
> web based application I urgently require help...
> Thanks in advance
> Kunal Ramesh Lalwani
> Software Developer
> Fahm Softwares
> India
>
|||Hi Hilary,
I think that it is a command and as far as i am known with asp.net, it
wont let run any of the shell commands.
|||Yes you are correct - my mistake. What sort of a doc is it, and why do you
wish to render it as text?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"kunal" <kunallalwani@.gmail.com> wrote in message
news:1129289278.890621.222690@.g49g2000cwa.googlegr oups.com...
> Hi Hilary,
> I think that it is a command and as far as i am known with asp.net, it
> wont let run any of the shell commands.
>
|||Actually we are uploading different kinds of doc and we need to store
its text also in the database for search purposes, hence finally the
path of the file upload will be dynamic ( Provided by the user of the
system), and i have confirmed that we cannot run any kind of shell
commands in web server, due to security issues and rights. So can you
help me with a work around..
|||No, there is no way that I know of to do this.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"kunal" <kunallalwani@.gmail.com> wrote in message
news:1129294138.272494.170330@.g47g2000cwa.googlegr oups.com...
> Actually we are uploading different kinds of doc and we need to store
> its text also in the database for search purposes, hence finally the
> path of the file upload will be dynamic ( Provided by the user of the
> system), and i have confirmed that we cannot run any kind of shell
> commands in web server, due to security issues and rights. So can you
> help me with a work around..
>
|||Hi Hillary i found an interesting link i hope you would like it...
http://robgarrett.com/Blogs/software...01/11/442.aspx
Just check it out...

How to call a stored procedure in asp.net

I have created a stored procedure only with an insert statement in sql server 2005.

How can i call this stored procedure through code in ASP.NET page using vb.

i want to pass one parameter that comes from a text box in asp.net page.

my emailid is:g12garg@.yahoo.co.in pls reply.

Thank you

Gaurav

dim conn as new sqlconnection("Your connection string here")

dim cmd as new sqlcommand("Your stored procedure name here",conn)

cmd.CommandType=CommandType.StoredProcedure

cmd.parameters.add("@.Your parameter name here",Your parameter type here).value=your parameter value here

conn.open

cmd.executenonquery

conn.close

|||

Thank you.

Now i want to encrypt this passing value in the stored procedure. i want the encryption to be done in the stored procedure using symmetric key. So do i need to convert this value to varbinary in the stored procedure. or only in the table?

Wednesday, March 7, 2012

How to call a parameterized stored procedure within a loop in ASP.NET

I would like to know what are the ways to call a parameterized stored procedure within a loop in ASP.NET.

Scenario:

I have a loop through a dataSet and for each record I am going to execute a stored procedure to insert data in many tables.

I can not use the following syntax:

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "dbo.storedprocedurename"

With cmd

.Parameters.Add(New SqlClient.SqlParameter("@.param1", paramValue1))

.Parameters.Add(New SqlClient.SqlParameter("@.param2", paramValue2))

End With

What are the other ways to execute the parameterized stored procedures within a loop in ASP.NET?

Thanks,

Carlos

As far as i know u can not execute stored procedure with out"CommandType.StoredProcedure"property.

other wise just write a insert query (that also needs parameters) thru loop and execute them by using execute non query

|||

I agree:

The problem is not the following lines:

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "dbo.storedprocedurename"

The problem is the following lines:

With cmd

.Parameters.Add(New SqlClient.SqlParameter("@.param1", paramValue1))

.Parameters.Add(New SqlClient.SqlParameter("@.param2", paramValue2))

End With

I was trying to find the alternative syntax to the lines above and the solution is to use:

With cmd

.Parameters.Add("@.param1", DbDataType.Varchar())

.Parameters.Add("@.param2", DbDataType.Varchar())

End With

Thanks,

Carlos

|||

You said you are going to execute the sproc in a loop, so be careful to clear the parameter collection after executing the sproc, otherwise the parameter's collection in your command object will keep on increasing and on the second loop itself it'll give you and error. This is not needed if you are nullifying and re-setting the command object every time.

Hope this will help.

|||

hi,

As you said you are using for loop for executing stored procedure, so clear the parameters collection after call execute nonquery method like this

cmd.ExecuteNonQuery();
lCmd.Parameters.Clear();

Hope it helps