Showing posts with label stored. Show all posts
Showing posts with label stored. Show all posts

Saturday, March 31, 2012

TableAdapter approach

I'm starting an application using a TableAdapter instead of direct sql
calls.
In my table adapter there's already an stored procedure that returns
columns a, b and c.
Now, I added another query, but now I need it to return columns b, c,
d, and f.
As you can see, columns does not match.

When I close the table adapter wizard for adding the query, it warns
me, or well, it informs me about this missmatch and tells me to check
it if that's the correct desire.

I thought this would throw an error, but it doesn't. I have a method
that return a different set of columns from those listed in the
TableAdapter.
Is this approach "correct" ?
If no, what's the proper way to do this ?

Thanks in advance,Any idea ?

TableAdapter Configuration Wizard

Hey

I am trying to get some practice on VS 2005 TableAdapter Configuration
Wizard. I wrote a Database project and include a couple of stored procedures
one of which was an insert procedure. The insert procedure obviously accepts
a few parameters (the values to insert).
I have a problem creating the connection in the TableAdapter Configuration
Wizard for the insert procedure. Basically I cannot map the parameters to the
database table columns where the value was to be inserted.
Can someone please point in the direction of a good tutorial that
demonstreates the creation and use of the TableAdapter Configuration Wizard.
I read something in 15seconds.com: http://www.15seconds.com/issue/050728.htm.
So if you have something other than this, It'd be deeply appreciated.

Thanks
HectorHi Hector:

Here are a couple to look at:

http://weblogs.asp.net/scottgu/arch.../15/435498.aspx
http://msdn.microsoft.com/vbasic/de...bleadapters.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 4 Feb 2006 18:34:27 -0800, "hecsan07" <hecsan07@.hotmail.com>
wrote:

>Hey
>I am trying to get some practice on VS 2005 TableAdapter Configuration
>Wizard. I wrote a Database project and include a couple of stored procedures
>one of which was an insert procedure. The insert procedure obviously accepts
>a few parameters (the values to insert).
>I have a problem creating the connection in the TableAdapter Configuration
>Wizard for the insert procedure. Basically I cannot map the parameters to the
>database table columns where the value was to be inserted.
>Can someone please point in the direction of a good tutorial that
>demonstreates the creation and use of the TableAdapter Configuration Wizard.
>I read something in 15seconds.com: http://www.15seconds.com/issue/050728.htm.
>So if you have something other than this, It'd be deeply appreciated.
>Thanks
>Hector

TableAdapter Configuration Wizard

Hey
I am trying to get some practice on VS 2005 TableAdapter Configuration
Wizard. I wrote a Database project and include a couple of stored procedures
one of which was an insert procedure. The insert procedure obviously accepts
a few parameters (the values to insert).
I have a problem creating the connection in the TableAdapter Configuration
Wizard for the insert procedure. Basically I cannot map the parameters to th
e
database table columns where the value was to be inserted.
Can someone please point in the direction of a good tutorial that
demonstreates the creation and use of the TableAdapter Configuration Wizard.
I read something in 15seconds.com: [url]http://www.15seconds.com/issue/050728.htm.[/url
]
So if you have something other than this, It'd be deeply appreciated.
Thanks
HectorHi Hector:
Here are a couple to look at:
http://weblogs.asp.net/scottgu/arch.../15/435498.aspx
http://msdn.microsoft.com/vbasic/de...
eadapters.asp
Scott
http://www.OdeToCode.com/blogs/scott/
On Sat, 4 Feb 2006 18:34:27 -0800, "hecsan07" <hecsan07@.hotmail.com>
wrote:

>Hey
>I am trying to get some practice on VS 2005 TableAdapter Configuration
>Wizard. I wrote a Database project and include a couple of stored procedure
s
>one of which was an insert procedure. The insert procedure obviously accept
s
>a few parameters (the values to insert).
>I have a problem creating the connection in the TableAdapter Configuration
>Wizard for the insert procedure. Basically I cannot map the parameters to t
he
>database table columns where the value was to be inserted.
>Can someone please point in the direction of a good tutorial that
>demonstreates the creation and use of the TableAdapter Configuration Wizard
.
>I read something in 15seconds.com: [url]http://www.15seconds.com/issue/050728.htm.[/ur
l]
>So if you have something other than this, It'd be deeply appreciated.
>Thanks
>Hector

Wednesday, March 28, 2012

TableAdapters Created in Dataset (XSD) Issues

Hi,
I've been trying to work with the XSDs and ran into a few road blocks.
1. Stored procedures that uses temp tables, i.e. #TempTable. The
wizard complains that #TempTable is an invalid object. What gives?
2. How do you programatically change the connection string at runtime
when using these TableAdapters via databinding in the IDE GUI?
Thanks,
Nick HustakNick,
Is the stored procedure creating the temp table itself, as opposed to
using a temp table that is created on the same connection by another
procedure?
Also, the connection string handling within 2005 for datasets (XSD) is
pretty weak in my opinion. If you're using the dataset within your
application, then it can use the application or web config file to
store the string. But if you're using a common dataset in a class
library then it uses the connection string from the sql server you have
registered in your IDE and stores it *programmatically* within the
settings designer code. It's because it is a class library and so will
use the configuration from the parent application.
The only way that I know of to override this is to change the
InitConnection method within the dataset designer code to use the
application config connection string from the parent application. This
works, but the obvious problem is that if you then need to change
anything with the adapter from the designer, it will overwrite this
code.
So I guess what you (and I) have to do is wait until right before the
application is to be deployed, and change the InitConnection methods to
use the configuration file settings. This, in my opinion, is not an
acceptable solution, but I'm not sure how else they could implement the
functionality.
Thanks,
Gary
On 27 Jun 2006 06:42:41 -0700, "Gary" <ggalehouse@.neo.rr.com> wrote:

>Nick,
>Is the stored procedure creating the temp table itself, as opposed to
>using a temp table that is created on the same connection by another
>procedure?
>Also, the connection string handling within 2005 for datasets (XSD) is
>pretty weak in my opinion. If you're using the dataset within your
>application, then it can use the application or web config file to
>store the string. But if you're using a common dataset in a class
>library then it uses the connection string from the sql server you have
>registered in your IDE and stores it *programmatically* within the
>settings designer code. It's because it is a class library and so will
>use the configuration from the parent application.
>The only way that I know of to override this is to change the
>InitConnection method within the dataset designer code to use the
>application config connection string from the parent application. This
>works, but the obvious problem is that if you then need to change
>anything with the adapter from the designer, it will overwrite this
>code.
>So I guess what you (and I) have to do is wait until right before the
>application is to be deployed, and change the InitConnection methods to
>use the configuration file settings. This, in my opinion, is not an
>acceptable solution, but I'm not sure how else they could implement the
>functionality.
>Thanks,
>Gary
Gary,
First, thanks for a well 'typed (spoken)' reply. My stored procs use
temp tables for intermediate calcs and things ala CREATE TABLE
#Temp...
I've since seen from another thread that MS KNOWS about this and did
nothing about it. It would appear you can still use the proc in a
dataset, but forget getting a schema in the IDE GUI - it won't read
it. Kind of silly IMHO.
And unfortunately you have confirmed my fear - they let this out the
door without serious consideration for how it works. Why in the world
they would not provide an easy way to override the connection strings
to datasets is beyond me. Wow they dropped the ball on the designer
- I'm a bit suprised seeing as they grabbed Anders from Delphi, which
has excellent designer support for databases work.
Oh well - thanks for the detailed explanation. I really am not happy
with having to remember to swap around the init string in the web
config. I toyed around with trying to manipulate it on the fly, but
it would seem it's completely locked out from programmatic
modification. That would have solved a lot of these issues.
I wonder if DLINQ is going to have the same silly issues. So
close..but these are damn near brick walls. I have zero urge to hand
code all my table objects - such a waste of time.
Thanks again,
Nick

TableAdapters Created in Dataset (XSD) Issues

Hi,
I've been trying to work with the XSDs and ran into a few road blocks.

1. Stored procedures that uses temp tables, i.e. #TempTable. The
wizard complains that #TempTable is an invalid object. What gives?

2. How do you programatically change the connection string at runtime
when using these TableAdapters via databinding in the IDE GUI?

Thanks,
Nick HustakNick,

Is the stored procedure creating the temp table itself, as opposed to
using a temp table that is created on the same connection by another
procedure?

Also, the connection string handling within 2005 for datasets (XSD) is
pretty weak in my opinion. If you're using the dataset within your
application, then it can use the application or web config file to
store the string. But if you're using a common dataset in a class
library then it uses the connection string from the sql server you have
registered in your IDE and stores it *programmatically* within the
settings designer code. It's because it is a class library and so will
use the configuration from the parent application.

The only way that I know of to override this is to change the
InitConnection method within the dataset designer code to use the
application config connection string from the parent application. This
works, but the obvious problem is that if you then need to change
anything with the adapter from the designer, it will overwrite this
code.

So I guess what you (and I) have to do is wait until right before the
application is to be deployed, and change the InitConnection methods to
use the configuration file settings. This, in my opinion, is not an
acceptable solution, but I'm not sure how else they could implement the
functionality.

Thanks,
Gary
On 27 Jun 2006 06:42:41 -0700, "Gary" <ggalehouse@.neo.rr.com> wrote:

>Nick,
>Is the stored procedure creating the temp table itself, as opposed to
>using a temp table that is created on the same connection by another
>procedure?
>Also, the connection string handling within 2005 for datasets (XSD) is
>pretty weak in my opinion. If you're using the dataset within your
>application, then it can use the application or web config file to
>store the string. But if you're using a common dataset in a class
>library then it uses the connection string from the sql server you have
>registered in your IDE and stores it *programmatically* within the
>settings designer code. It's because it is a class library and so will
>use the configuration from the parent application.
>The only way that I know of to override this is to change the
>InitConnection method within the dataset designer code to use the
>application config connection string from the parent application. This
>works, but the obvious problem is that if you then need to change
>anything with the adapter from the designer, it will overwrite this
>code.
>So I guess what you (and I) have to do is wait until right before the
>application is to be deployed, and change the InitConnection methods to
>use the configuration file settings. This, in my opinion, is not an
>acceptable solution, but I'm not sure how else they could implement the
>functionality.
>Thanks,
>Gary

Gary,
First, thanks for a well 'typed (spoken)' reply. My stored procs use
temp tables for intermediate calcs and things ala CREATE TABLE
#Temp...

I've since seen from another thread that MS KNOWS about this and did
nothing about it. It would appear you can still use the proc in a
dataset, but forget getting a schema in the IDE GUI - it won't read
it. Kind of silly IMHO.

And unfortunately you have confirmed my fear - they let this out the
door without serious consideration for how it works. Why in the world
they would not provide an easy way to override the connection strings
to datasets is beyond me. Wow they dropped the ball on the designer
- I'm a bit suprised seeing as they grabbed Anders from Delphi, which
has excellent designer support for databases work.

Oh well - thanks for the detailed explanation. I really am not happy
with having to remember to swap around the init string in the web
config. I toyed around with trying to manipulate it on the fly, but
it would seem it's completely locked out from programmatic
modification. That would have solved a lot of these issues.

I wonder if DLINQ is going to have the same silly issues. So
close..but these are damn near brick walls. I have zero urge to hand
code all my table objects - such a waste of time.

Thanks again,
Nick

Saturday, March 24, 2012

TabStrip control help

Can anyone point me in the right direction here? I want to provide a tab
strip of the alphabet "A - Z". I have a stored procedure to look up company
records in an SQL 2000 database. My vision is to have a datagrid on each
tab, and when the user clicks the tab, it populates the datagrid with
company records corresponding to the letter clicked. I basically would want
the tabs blank, and when the user clicks a letter, it will run a stored
procedure passing the tab letter as a parameter and the datagrid on that tab
will be populated by the results. Can anyone point me in the right
direction?

Thanks All,
ChrisThough the Windows applications have it, ASP.NET does not come with a tab
strip control. There is a microsoft-provided set of web controls called the
"IE Webcontrols", but they are unsupported by Microsoft. However, in a way
that's good news because you can download them complete with source code.
I've used them successfully. I haven't had to download them in awhile, but
I am sure you could find them with google.

"Chris Kettenbach" <info@.piasd.net> wrote in message
news:noqdndmik57Wx-ffRVn-2w@.giganews.com...
> Can anyone point me in the right direction here? I want to provide a tab
> strip of the alphabet "A - Z". I have a stored procedure to look up
> company records in an SQL 2000 database. My vision is to have a datagrid
> on each tab, and when the user clicks the tab, it populates the datagrid
> with company records corresponding to the letter clicked. I basically
> would want the tabs blank, and when the user clicks a letter, it will run
> a stored procedure passing the tab letter as a parameter and the datagrid
> on that tab will be populated by the results. Can anyone point me in the
> right direction?
> Thanks All,
> Chris

TabStrip control help

Can anyone point me in the right direction here? I want to provide a tab
strip of the alphabet "A - Z". I have a stored procedure to look up company
records in an SQL 2000 database. My vision is to have a datagrid on each
tab, and when the user clicks the tab, it populates the datagrid with
company records corresponding to the letter clicked. I basically would want
the tabs blank, and when the user clicks a letter, it will run a stored
procedure passing the tab letter as a parameter and the datagrid on that tab
will be populated by the results. Can anyone point me in the right
direction?
Thanks All,
ChrisThough the Windows applications have it, ASP.NET does not come with a tab
strip control. There is a microsoft-provided set of web controls called the
"IE Webcontrols", but they are unsupported by Microsoft. However, in a way
that's good news because you can download them complete with source code.
I've used them successfully. I haven't had to download them in awhile, but
I am sure you could find them with google.
"Chris Kettenbach" <info@.piasd.net> wrote in message
news:noqdndmik57Wx-ffRVn-2w@.giganews.com...
> Can anyone point me in the right direction here? I want to provide a tab
> strip of the alphabet "A - Z". I have a stored procedure to look up
> company records in an SQL 2000 database. My vision is to have a datagrid
> on each tab, and when the user clicks the tab, it populates the datagrid
> with company records corresponding to the letter clicked. I basically
> would want the tabs blank, and when the user clicks a letter, it will run
> a stored procedure passing the tab letter as a parameter and the datagrid
> on that tab will be populated by the results. Can anyone point me in the
> right direction?
> Thanks All,
> Chris
>

Thursday, March 22, 2012

take only the "number" from QueryString - how?

hi,

i have a stored procedure witch returns details about a picture and wich have an input parameter (PictureID)

the page is something like this "Picture.aspx?PictureID=5"

how can i take only the 5 from the Rrequest.QueryString["PictureID"] to use it as input parameter to stored procedure?

thanks

Are you asking how to get the value from the querystring, or how to give it as a parameter to your sproc?

Getting the value is simple. Convert.ToInt32(Request.QueryString["PictureID"])


Hello zuperboy,

Use in the page_load event:

int PictureId = Convert.ToInt32(Request.QueyString["PictureID"]);

Set PictureId as the input parameter of the stored procedure. I guess you know how that part works.

Jeroen Molenaar.


thank you to you two, this was easy:P