Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Monday, March 19, 2012

new server gives login error URGENT

This is on my web page from a log in:
Microsoft OLE DB Provider for SQL Server error '80004005'
Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with a
trusted SQL Server connection.
/admin/addconn_1.asp, line 7
I have take a new server given it the former IP of the old one, restored the
data from the old one, and done a DTS for transfer of users.
That DTS gives an error, but no details. I can see Error Occured in the
status, and nothing more
Where do I go to next?Hi
Please check out what is sql server's authentication.
Probably you have "windows only" authentication , try to change it to
"mixed"
"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
> This is on my web page from a log in:
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with
> a trusted SQL Server connection.
> /admin/addconn_1.asp, line 7
>
> I have take a new server given it the former IP of the old one, restored
> the data from the old one, and done a DTS for transfer of users.
>
> That DTS gives an error, but no details. I can see Error Occured in the
> status, and nothing more
> Where do I go to next?
>
>|||Thanks, correct that new box was set as Win only. that has been changed to
mixed. DTS package still fails after stop & start of service.
Any other ideas?
I see the UserID in the actual db for the serve and I see the userid in the
security login for that server for all dbs.
Stephen
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi
> Please check out what is sql server's authentication.
> Probably you have "windows only" authentication , try to change it to
> "mixed"
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>|||I didn't see an * properly as an ending char for a PW. I thought that it
was a ".
Thanks again!
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi
> Please check out what is sql server's authentication.
> Probably you have "windows only" authentication , try to change it to
> "mixed"
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>|||Do you call the DTS from a job ?
If you do ,an another option is that you have created a package on your
workstation , i mean the owner of the package is not the same as an acount
that SQL Server Agent running under.
"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:OV64bZgEGHA.344@.TK2MSFTNGP11.phx.gbl...
> Thanks, correct that new box was set as Win only. that has been changed
> to mixed. DTS package still fails after stop & start of service.
> Any other ideas?
> I see the UserID in the actual db for the serve and I see the userid in
> the security login for that server for all dbs.
> Stephen
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
>|||Stephen,
Make sure that user 'TGI_Int_Admin_Webapp' is added to appropriate
windows group on the new server and that you have granted that windows group
appropriate windows permissions.
"__Stephen" wrote:

> This is on my web page from a log in:
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with
a
> trusted SQL Server connection.
> /admin/addconn_1.asp, line 7
>
> I have take a new server given it the former IP of the old one, restored t
he
> data from the old one, and done a DTS for transfer of users.
>
> That DTS gives an error, but no details. I can see Error Occured in the
> status, and nothing more
> Where do I go to next?
>
>
>|||Thanks Uri, I even went to the cold cellar or server room, and it failed
there as well.
The mixed authentication worked when I fixed the login/pw to be correct. I
hate an old dheap monitor for the server rack!
__Stephen
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ux1XGfgEGHA.2040@.TK2MSFTNGP14.phx.gbl...
> Do you call the DTS from a job ?
> If you do ,an another option is that you have created a package on your
> workstation , i mean the owner of the package is not the same as an
> acount that SQL Server Agent running under.
>
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:OV64bZgEGHA.344@.TK2MSFTNGP11.phx.gbl...
>|||"Pradeep Gharat" <PradeepGharat@.discussions.microsoft.com> wrote in message
news:63A6D7CC-98DA-4759-A39A-58CE46191F82@.microsoft.com...
> Stephen,
> Make sure that user 'TGI_Int_Admin_Webapp' is added to appropriate
> windows group on the new server and that you have granted that windows
> group
> appropriate windows permissions.
Actually I don't want to do that. I added the SQL Authentication and it's
running now.

new server gives login error URGENT

This is on my web page from a log in:
Microsoft OLE DB Provider for SQL Server error '80004005'
Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with a
trusted SQL Server connection.
/admin/addconn_1.asp, line 7
I have take a new server given it the former IP of the old one, restored the
data from the old one, and done a DTS for transfer of users.
That DTS gives an error, but no details. I can see Error Occured in the
status, and nothing more
Where do I go to next?
Hi
Please check out what is sql server's authentication.
Probably you have "windows only" authentication , try to change it to
"mixed"
"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
> This is on my web page from a log in:
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with
> a trusted SQL Server connection.
> /admin/addconn_1.asp, line 7
>
> I have take a new server given it the former IP of the old one, restored
> the data from the old one, and done a DTS for transfer of users.
>
> That DTS gives an error, but no details. I can see Error Occured in the
> status, and nothing more
> Where do I go to next?
>
>
|||Thanks, correct that new box was set as Win only. that has been changed to
mixed. DTS package still fails after stop & start of service.
Any other ideas?
I see the UserID in the actual db for the serve and I see the userid in the
security login for that server for all dbs.
Stephen
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi
> Please check out what is sql server's authentication.
> Probably you have "windows only" authentication , try to change it to
> "mixed"
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>
|||I didn't see an * properly as an ending char for a PW. I thought that it
was a ".
Thanks again!
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi
> Please check out what is sql server's authentication.
> Probably you have "windows only" authentication , try to change it to
> "mixed"
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>
|||Do you call the DTS from a job ?
If you do ,an another option is that you have created a package on your
workstation , i mean the owner of the package is not the same as an acount
that SQL Server Agent running under.
"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:OV64bZgEGHA.344@.TK2MSFTNGP11.phx.gbl...
> Thanks, correct that new box was set as Win only. that has been changed
> to mixed. DTS package still fails after stop & start of service.
> Any other ideas?
> I see the UserID in the actual db for the serve and I see the userid in
> the security login for that server for all dbs.
> Stephen
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
>
|||Stephen,
Make sure that user 'TGI_Int_Admin_Webapp' is added to appropriate
windows group on the new server and that you have granted that windows group
appropriate windows permissions.
"__Stephen" wrote:

> This is on my web page from a log in:
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with a
> trusted SQL Server connection.
> /admin/addconn_1.asp, line 7
>
> I have take a new server given it the former IP of the old one, restored the
> data from the old one, and done a DTS for transfer of users.
>
> That DTS gives an error, but no details. I can see Error Occured in the
> status, and nothing more
> Where do I go to next?
>
>
>
|||Thanks Uri, I even went to the cold cellar or server room, and it failed
there as well.
The mixed authentication worked when I fixed the login/pw to be correct. I
hate an old dheap monitor for the server rack!
__Stephen
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ux1XGfgEGHA.2040@.TK2MSFTNGP14.phx.gbl...
> Do you call the DTS from a job ?
> If you do ,an another option is that you have created a package on your
> workstation , i mean the owner of the package is not the same as an
> acount that SQL Server Agent running under.
>
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:OV64bZgEGHA.344@.TK2MSFTNGP11.phx.gbl...
>
|||"Pradeep Gharat" <PradeepGharat@.discussions.microsoft.com> wrote in message
news:63A6D7CC-98DA-4759-A39A-58CE46191F82@.microsoft.com...
> Stephen,
> Make sure that user 'TGI_Int_Admin_Webapp' is added to appropriate
> windows group on the new server and that you have granted that windows
> group
> appropriate windows permissions.
Actually I don't want to do that. I added the SQL Authentication and it's
running now.

new server gives login error URGENT

This is on my web page from a log in:
Microsoft OLE DB Provider for SQL Server error '80004005'
Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with a
trusted SQL Server connection.
/admin/addconn_1.asp, line 7
I have take a new server given it the former IP of the old one, restored the
data from the old one, and done a DTS for transfer of users.
That DTS gives an error, but no details. I can see Error Occured in the
status, and nothing more :(
Where do I go to next?Do you have mixed authentication mode on that server?
right click the server-->properties-->security and take a look, is
windows only checked?|||Hi
Please check out what is sql server's authentication.
Probably you have "windows only" authentication , try to change it to
"mixed"
"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
> This is on my web page from a log in:
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with
> a trusted SQL Server connection.
> /admin/addconn_1.asp, line 7
>
> I have take a new server given it the former IP of the old one, restored
> the data from the old one, and done a DTS for transfer of users.
>
> That DTS gives an error, but no details. I can see Error Occured in the
> status, and nothing more :(
> Where do I go to next?
>
>|||Seems that your are not using mixed authentication. Try to set the
server to mixed authentication.
HTH, jens Suessmeyer.|||Thanks, correct that new box was set as Win only. that has been changed to
mixed. DTS package still fails after stop & start of service.
Any other ideas?
I see the UserID in the actual db for the serve and I see the userid in the
security login for that server for all dbs.
Stephen
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi
> Please check out what is sql server's authentication.
> Probably you have "windows only" authentication , try to change it to
> "mixed"
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>> This is on my web page from a log in:
>> Microsoft OLE DB Provider for SQL Server error '80004005'
>> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with
>> a trusted SQL Server connection.
>> /admin/addconn_1.asp, line 7
>>
>> I have take a new server given it the former IP of the old one, restored
>> the data from the old one, and done a DTS for transfer of users.
>>
>> That DTS gives an error, but no details. I can see Error Occured in the
>> status, and nothing more :(
>> Where do I go to next?
>>
>>
>|||Thanks, correct that new box was set as Win only. that has been changed to
mixed. DTS package still fails after stop & start of service.
Any other ideas?
I see the UserID in the actual db for the serve and I see the userid in the
security login for that server for all dbs.
Stephen
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1136471412.242368.94270@.f14g2000cwb.googlegroups.com...
> Do you have mixed authentication mode on that server?
> right click the server-->properties-->security and take a look, is
> windows only checked?
>|||Thanks
I wasn't using mixed authentication as well as confusing * with " on a fuzzy
server monitor!!
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1136471757.457363.194350@.g14g2000cwa.googlegroups.com...
> Seems that your are not using mixed authentication. Try to set the
> server to mixed authentication.
> HTH, jens Suessmeyer.
>|||I didn't see an * properly as an ending char for a PW. I thought that it
was a ".
Thanks again!
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Hi
> Please check out what is sql server's authentication.
> Probably you have "windows only" authentication , try to change it to
> "mixed"
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>> This is on my web page from a log in:
>> Microsoft OLE DB Provider for SQL Server error '80004005'
>> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with
>> a trusted SQL Server connection.
>> /admin/addconn_1.asp, line 7
>>
>> I have take a new server given it the former IP of the old one, restored
>> the data from the old one, and done a DTS for transfer of users.
>>
>> That DTS gives an error, but no details. I can see Error Occured in the
>> status, and nothing more :(
>> Where do I go to next?
>>
>>
>|||I didn't see an * properly as an ending char for a PW. I thought that it
was a ".
Thanks again!
"SQL" <denis.gobo@.gmail.com> wrote in message
news:1136471412.242368.94270@.f14g2000cwb.googlegroups.com...
> Do you have mixed authentication mode on that server?
> right click the server-->properties-->security and take a look, is
> windows only checked?
>|||Do you call the DTS from a job ?
If you do ,an another option is that you have created a package on your
workstation , i mean the owner of the package is not the same as an acount
that SQL Server Agent running under.
"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:OV64bZgEGHA.344@.TK2MSFTNGP11.phx.gbl...
> Thanks, correct that new box was set as Win only. that has been changed
> to mixed. DTS package still fails after stop & start of service.
> Any other ideas?
> I see the UserID in the actual db for the serve and I see the userid in
> the security login for that server for all dbs.
> Stephen
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
>> Hi
>> Please check out what is sql server's authentication.
>> Probably you have "windows only" authentication , try to change it to
>> "mixed"
>>
>> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
>> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>> This is on my web page from a log in:
>> Microsoft OLE DB Provider for SQL Server error '80004005'
>> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated
>> with a trusted SQL Server connection.
>> /admin/addconn_1.asp, line 7
>>
>> I have take a new server given it the former IP of the old one, restored
>> the data from the old one, and done a DTS for transfer of users.
>>
>> That DTS gives an error, but no details. I can see Error Occured in the
>> status, and nothing more :(
>> Where do I go to next?
>>
>>
>>
>|||Stephen,
Make sure that user 'TGI_Int_Admin_Webapp' is added to appropriate
windows group on the new server and that you have granted that windows group
appropriate windows permissions.
"__Stephen" wrote:
> This is on my web page from a log in:
> Microsoft OLE DB Provider for SQL Server error '80004005'
> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated with a
> trusted SQL Server connection.
> /admin/addconn_1.asp, line 7
>
> I have take a new server given it the former IP of the old one, restored the
> data from the old one, and done a DTS for transfer of users.
>
> That DTS gives an error, but no details. I can see Error Occured in the
> status, and nothing more :(
> Where do I go to next?
>
>
>|||Thanks Uri, I even went to the cold cellar or server room, and it failed
there as well.
The mixed authentication worked when I fixed the login/pw to be correct. I
hate an old dheap monitor for the server rack!
__Stephen
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ux1XGfgEGHA.2040@.TK2MSFTNGP14.phx.gbl...
> Do you call the DTS from a job ?
> If you do ,an another option is that you have created a package on your
> workstation , i mean the owner of the package is not the same as an
> acount that SQL Server Agent running under.
>
>
> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
> news:OV64bZgEGHA.344@.TK2MSFTNGP11.phx.gbl...
>> Thanks, correct that new box was set as Win only. that has been changed
>> to mixed. DTS package still fails after stop & start of service.
>> Any other ideas?
>> I see the UserID in the actual db for the serve and I see the userid in
>> the security login for that server for all dbs.
>> Stephen
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:ed4jrSgEGHA.1032@.TK2MSFTNGP11.phx.gbl...
>> Hi
>> Please check out what is sql server's authentication.
>> Probably you have "windows only" authentication , try to change it to
>> "mixed"
>>
>> "__Stephen" <srussell@.transactiongraphics.com> wrote in message
>> news:eYzSbOgEGHA.140@.TK2MSFTNGP12.phx.gbl...
>> This is on my web page from a log in:
>> Microsoft OLE DB Provider for SQL Server error '80004005'
>> Login failed for user 'TGI_Int_Admin_Webapp'. Reason: Not associated
>> with a trusted SQL Server connection.
>> /admin/addconn_1.asp, line 7
>>
>> I have take a new server given it the former IP of the old one,
>> restored the data from the old one, and done a DTS for transfer of
>> users.
>>
>> That DTS gives an error, but no details. I can see Error Occured in
>> the status, and nothing more :(
>> Where do I go to next?
>>
>>
>>
>>
>|||"Pradeep Gharat" <PradeepGharat@.discussions.microsoft.com> wrote in message
news:63A6D7CC-98DA-4759-A39A-58CE46191F82@.microsoft.com...
> Stephen,
> Make sure that user 'TGI_Int_Admin_Webapp' is added to appropriate
> windows group on the new server and that you have granted that windows
> group
> appropriate windows permissions.
Actually I don't want to do that. I added the SQL Authentication and it's
running now.

new record - new page

I made a group by TestObjectID.
When it changes, i would like to show records for that ID on the next page.
So, that with new ID, I have a new page with data.There should be 2 properties for the Group's section called 'NewPageBefore' and 'NewPageAfter' Set one of those to True.

Monday, March 12, 2012

New Page after a Group Prints

How can I force a new page after a group has been printed?
Ex:
Group 1a (can be on many pages)
Group 1b (needs to stay hidden until Group 1a prints)
Group 1a Footer Prints.
Then For a new page then... Group 1b prints (which takes up the whole page)Check the 'New Page after' in the 'Section Expert' for the GF1a.

Friday, March 9, 2012

new local printing with "error on page"

Hallo
I have a problem with local printing with SP2. As administrator I can
press the new button and receive the question about Security and then
the ActiveX Control RSClientPrint is installed.
As an ordinary user I receive an error on page. "Object doesn't support
this property or method" and the ActiveX Control isn't installed.
Has anybody a good idea how I can install the Control on a computer as
user and not as administrator?
Thanks!This is not a RS issue, but one to do with the permissions granted to
oridnary users, possibly through your Group profile. You could have a look
in IE at the Custom Level Security Settings under "Internet Options" but if
you are in a work environment you need to speak to the network admins. If
you are the network admin, try posting in their group. If this has only
happened since installing SP2 go back to the Security Settings for ActiveX
controls and have a look at the settings.
--
Mary Bray [SQL Server MVP]
Please reply only to newsgroups
<linus@.dplanet.ch> wrote in message
news:1116705736.745994.168630@.f14g2000cwb.googlegroups.com...
> Hallo
> I have a problem with local printing with SP2. As administrator I can
> press the new button and receive the question about Security and then
> the ActiveX Control RSClientPrint is installed.
> As an ordinary user I receive an error on page. "Object doesn't support
> this property or method" and the ActiveX Control isn't installed.
> Has anybody a good idea how I can install the Control on a computer as
> user and not as administrator?
> Thanks!
>

Wednesday, March 7, 2012

New install shows nothing when I go to http://localhost/reportserver

I get a page that looks like a directory browsing page and it says

Microsoft SQL Server Reporting Services Version 9.00.1399.00

at the bottom. Any ideas?

report manager URL should be

http://localhost/reports

you can also select "Reporting Services Configuration Manager" from the start menu -> "Microsoft SQL Server 2005" -> "Configuration Tools" to view your virtual directory settings.

|||Duh. Thanks!

New Id

I am using Microsoft Visual Studios 2005 Pro creating a web form in asp.net with a vb.net code page. I am trying to get the id of a newly inserted record. I am using the sqldatasource insert command to insert the record. Does anybody know how to return the new id. during the insert? Thanks, Any help is appreciated

there are basically 2 ways of doing that.

1. Create ID before you do insert using something like SELECT Max(id) +1 FROM ... Use this approach if you ID field is not set as a identity column

2. If your id field is an identity field then you can write a stored procedure that inserts the record and then you do something like

SET @.ID = scope_identity()

Where @.ID is your output parameter or you can return it as a return value.

|||

Here is a modified sample from Quickstarts tutorial with inline SQL for insert (ContactID is the Identity field of the table):

ProtectedSub SqlDataSource1_Inserted(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)

Response.Write("Record Inserted: " + Server.HtmlEncode(e.Command.Parameters("@.ContactID").Value.ToString()) +"<br/>")

EndSub

<asp:GridViewAutoGenerateColumns="False"DataKeyNames="ContactID"DataSourceID="SqlDataSource1"

ID="GridView1"runat="server">

<Columns>

<asp:CommandFieldShowDeleteButton="True"/>

<asp:BoundFieldDataField="ContactID"HeaderText="ContactID"InsertVisible="False"

ReadOnly="True"SortExpression="ContactID"/>

<asp:BoundFieldDataField="ContactName"HeaderText="ContactName"SortExpression="ContactName"/>

</Columns>

</asp:GridView>

<asp:SqlDataSourceConnectionString="<%$ ConnectionStrings:MSDN_forumConnectionString %>"ID="SqlDataSource1"

runat="server"SelectCommand="select ContactID, ContactName from Contacts"

InsertCommand="INSERT INTO Contacts (ContactName) VALUES (@.contactName);SELECT @.contactID = Scope_Identity()"

OnInserted="SqlDataSource1_Inserted"DeleteCommand="DELETE FROM Contacts WHERE ContactID = @.ContactID">

<InsertParameters>

<asp:ParameterName="contactName"Type="String"/>

<asp:ParameterDirection="Output"Name="contactID"Type="Int32"/>

</InsertParameters>

<DeleteParameters>

<asp:ParameterName="ContactID"/>

</DeleteParameters>

</asp:SqlDataSource>

<br/>

<asp:DetailsViewAutoGenerateRows="False"DataKeyNames="ContactID"DataSourceID="SqlDataSource1"

DefaultMode="Insert"HeaderText="Insert New Contact"Height="50px"ID="DetailsView1"

runat="server"Width="125px">

<Fields>

<asp:BoundFieldDataField="ContactID"HeaderText="ContactID"InsertVisible="False"

ReadOnly="True"SortExpression="ContactID"/>

<asp:BoundFieldDataField="ContactName"HeaderText="ContactName"SortExpression="ContactName"/>

<asp:CommandFieldShowInsertButton="True"/>

</Fields>

</asp:DetailsView>

|||

orka777:

there are basically 2 ways of doing that.

1. Create ID before you do insert using something like SELECT Max(id) +1 FROM ... Use this approach if you ID field is not set as a identity column

2. If your id field is an identity field then you can write a stored procedure that inserts the record and then you do something like

SET @.ID = scope_identity()

Where @.ID is your output parameter or you can return it as a return value.

For Number 1, is correct but might no be that good even it will do the job for you.

For Number 2, the code should be like:

1SET @.MyIdentity =@.@.IDENTITY

Where @.MyIdentity in an output parameter of type int.

 

Here I prefere to not return the identity of the inserted record as an output parameter, I perefere to return it using the Return statment in the stored procedure., like:

1CREATE PROCEDURE MySP23AS45SET NOCOUNT ON67declare MyIdentityint-- as a normal variable in the stored procedure body89Insert Into MyTable (col1, col2)values ('A','B')10SET @.MyIdentity =ISNULL(@.@.IDENTITY,-1)-- if no record is inserted then you will get -1111213Return @.MyIdentity1415SET NOCOUNT OFF16

Good luck.|||

I am trying to do this through the sqldatasource1.insert statement that I have built using the querybuilder. When I try to put in the @.ID as an output or as a return value It says I need to declare the scalar variable. I have already added in the parameters area and it is set to output with the control being the textbox that I want the Id in. But when I add the line "SET @.NewID = scope_identity()" or "SET @.NewID = @.@.identity" then I get an error on both @.NewId and @.SN which is another scalar variable which normally works fine and works fine again after I pull that line out. But I'm not doing it as a stored procedure. Could that be the problem? I don't know about stored procedures. How do I create them?

|||

Carehalf:

I don't know about stored procedures. How do I create them?

Just check my last post, it is a complete running fine example.

Anyway.. here is a very simple example:

1CREATE PROCEDURE MyStoredProcedureName2@.MyInputParameterint,-- input parameter of type integer3@.MyOutputParameterint OUTPUT-- output parameter of type integer45AS67-- write you statments here8-- and here9-- and here as well :)1011-- how to set a value for ourput parameter12SET @.MyOutputParameter = 100-- just for example1314-- how to increment the input parameter by 1 (for example)15SET @.MyInputParameter = @.MyInputParameter + 1161718/* At the end you the @.MyOutputParameter output parameter value19 will be 100 (as per the logic in this simple example20 Did you see how easy it is to created a stored procedure? */21

Good luck.

|||

I understand the stored procedure from looking at your last statement and this one, but I am not sure where to create it

|||

Carehalf:

I understand the stored procedure from looking at your last statement and this one, but I am not sure where to create it

Create you stored procedures in your application/project database.

Example:

USE MyDatabase
GO

Then the CREATE PROCEDURE statment as in my last two posts.

Good luck.

|||

Carehalf:

Create a table in your database and copy the code sample I posted (change the connection string in the code) and check the syntax to work for you if you don't want to create the Stored Procedure.

Here is the table definition:

CREATETABLE [dbo].[Contacts](

[ContactID] [int]IDENTITY(1,1)NOTNULL,

[ContactName] [nvarchar](50)

)