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

Wednesday, March 28, 2012

how to create my Validate Login SP IN sql 2000 ?

hi,all:

I'm new to Sql 2000,now I have a login asp.net page and I used the sql 2000 database.

my login page included a user id and password need user inputed. if the user input the correct userid

and password ,IE will transfer to main page,or there will show eorror message in login page.

my SP like this:

CREATE PROCEDURE dbo.Usp_Accounts_ValidateLogin
@.userid char(4) ,
@.EncPassword binary
AS
if (select count(*) from hhmxUserData whereUserid=@.userid andUserPWD=@.EncPassword) >0

return 1

else

return 0
GO
my asp.net code like this:

dim result As Integer

dim rowsAffected as integer

myConnection.Open()
Dim command As SqlCommand = BuildIntCommand(storedProcName, parameters)
rowsAffected = command.ExecuteNonQuery
result = CInt(command.Parameters("ReturnValue").Value)
myConnection.Close()

Return result

I test it in sql 2000,it's ok.but when I performed it and retrieve the "returnValue", it still return 0 .

so how can I create my correct SP ?

thanks so much.

Change your datatype of userid from char(4) to varchar(4). When you use CHAR, if your user enter the userid which is less than 4 characters in length spaces will be added at the end and your search query may not look like what is should be.

|||

Yes,my UserID is fixed 4 characters length (like: 1012,1008),I think it's not problem,the point is I'm always get the wrong returnValue in my asp.net code when I performed my SP.

So maybe my SP has problem ?

|||

I would recommend you use OUTPUT parameters. check out Books On Line for more info.

check the 2nd part inthis articleto retrieve the output from OUTPUT variable.

Friday, March 23, 2012

how to create ASPNET user in SQL Server 2000

Respected Members,

I have a question, when our aspx page is trying to access the SQL Server 2000 database than before this do we have to creaete a user with the name of ASPNET in SQL Server 2000, or without creating this paticular user(its the default user of ASP.NET account) our aspx pages can also access the SQL Server 2000,I have already SQL Server 2000 running in "SQL Server Authentication Mode" so while creating the user do I have to create it in "Windows Authentication" or "SQL Server Authentication", can you provide some link where I could find complete steps for craeting the ASPNET user or if some one can tell all the steps in details here.

This site has some good video tutorials for handling security in both ASP and SQL Server.

http://www.asp.net/learn/videos/default.aspx?tabid=63

|||Thanks for your reply, the site was really good,but I did'nt found any thing relevant to my question on this web site, do you have some idea about any other resources.|||

It seemed to me, perhaps I'm wrong, that the following video tutorials at that site are relevant to your task. ( realize that you indicated you are using SQL Server 2000 (which is a mistake -you should be using SQL Server 2005), but the concepts are basically the same.

And of course, you could refer to Books Online, the definitive source for SQL Server information.

From the “How Do I?” with ASP.NET section:

#7 | How Do I: Secure my Site using Membership and Roles?#9 | How Do I: Create a Full-Featured Customer Login Portal?

From the SQL Server 2005 Express for Beginners section:#7 | Understanding Security and Network Connectivity#8 | Connecting your Web Application to SQL Server 2005 Express Edition

From the Videos for ASP.NET 2.0 Beginners section:#9 | Lesson 9: Securing your Web Site with Membership and Login Controls

how to create ASPNET user in SQL Server 2000

Respected Members,

I have a question, when our aspx page is trying to access the SQL Server 2000 database than before this do we have to creaete a user with the name of ASPNET in SQL Server 2000, or without creating this paticular user(its the default user of ASP.NET account) our aspx pages can also access the SQL Server 2000,I have already SQL Server 2000 running in "SQL Server Authentication Mode" so while creating the user do I have to create it in "Windows Authentication" or "SQL Server Authentication", can you provide some link where I could find complete steps for craeting the ASPNET user or if some one can tell all the steps in details here.

Maybe this link will help:http://msdn2.microsoft.com/en-us/library/ms998300.aspx

Wednesday, March 21, 2012

How to create a update button to update two SqlDataSource controls?

I want to update two tables in one page. So I created two FormView bound on two SqlDataSource controls, and I create a Update button on the bottom of page. And I writen some codes as below:

btnUpate_Click(object sender, EventArgs e)
{

sqlDataSource1.Update();

sqlDateSource2.Update();
}

But, the records haven't updated.

In SqlDataSource2_Updating() function, I found all the parameters is null.

So, how to modify my code to do it.

Zhang

You need to actually set the update parameters. Take a look at this link.

http://msdn2.microsoft.com/en-us/library/fkzs2t3h(VS.80).aspx

Sub EmployeeDetailsSqlDataSource_OnInserted(senderAsObject, eAs SqlDataSourceStatusEventArgs)
Dim commandAs System.Data.Common.DbCommand = e.Command

EmployeeDetailsSqlDataSource.SelectParameters("EmpID").DefaultValue = _
command.Parameters("@.EmpID").Value.ToString()

EmployeesGridView.DataBind()
EmployeeFormView.DataBind()
EndSub

|||

I set the parameters' DafaultValue in the Clicked Event of the Update button. And it work fine.

But it is too hard to set so much parameters by codes. Are there any ways to set them automatically as the update link button had done in the FormView?

How to create a torn page.

I want to write a magazine article about torn pages. Is there an easy way to create a torn page? Or does anybody have a backup of a sample database such as AdventureWorks that has a torn page?

I suppose you have to simulate a disk failure at the right moment. I don't think it is very easy to simulate tbh.

But do keep us informed if you find a way to do so.

|||

To simulate a torn page, you'll have to "corrupt" a database page on disk.

This can be done with a hex editor, or other tool.

Our pages are 8K in size, so 16 sectors of 512bytes.

We have 2 kinds of validation: checksum or torn page.

For the torn page, you'll want to corrupt bytes at 0 mod 512 in sectors 1..15 of a page. You could write 0x00 at offset 512, and 0xFF at offset 1024, for example.

Checksums are more robust, so you should be able to change any bit on the page to cause the corruption to be detected.

In order for this corruption to cause any problem, you'd have to pick a page that actually holds data, and then cause the engine to try to read that page.

Hope that gives you some ideas.

|||

Aah, think out of the box :-)

Great tip.

How to create a table with query

I want to create a empty new table (if it doesn't exist)
when the the page/program starts. Maybe with copying field names from other table.
It would be nice to have its name personal for each user. But I don't know if it possible.
Also, what event is best place for this.

Perhaps like this:

dim username as string = Page.User.Identity.Name

Dim tablename as string

tablename= shopping_basket+username

create from t_product new

@.tablename

What you are thinking of doing is not a very good idea. You will have to give the user higher permissions to create tables on the fly and if they are not cleaned up properly you will end up with tons of tables that you dont know if they are being used or not. On the otherhand, think of using temp tables or table variables in the proc.

|||

Aha good to know, and yes I should thought about that myself.

What about a table with a constant name. But then, have you good code using or making a temp table or table variable.

What is a table variable?

Regards

Leif

|||

LISM:

What about a table with a constant name.

You can do that too. If you can identify a batch from a different batch via some unique key. If you have multiple users inserting into that table you should have a way of identifying one set from the other.

LISM:

But then, have you good code using or making a temp table or table variable.

What is a table variable?

Please read up books online on these topics. They have a much better explanation than what I can type.

How to create a subtotal per page?

Good day,

I have a report that computes the subtotal of an amount per page. I tried creating a group on a table but it doesn't allow the Globals.PageNumber to be used inside the body. How do you do this?

Thanks

Ayaw sige pag pasipat diha gud!!!

i search rana oi!!!!

|||

Thanks a lot!!

It really helped me.

Monday, March 12, 2012

How to create a field that may accoss multiple pages?

I have a memo field that may not fit into one page. Is there any solution to let crystal report create multiple pages automatically at runtime? Splitting the string manually may not be the solution because how many characters are displayed for each page cannot be determined at the design time.

Thanks in advance!Doesn't the 'Can Grow' option work? (Right click field, Format Field, Common tab)?|||'Can Grow' does not work because the displaying area has to be fixed while the message may be too long to fit into one page.

Friday, March 9, 2012

How to create a cover page

This seems like it should be a very simple task. I need to create a cover page that appears as the first page of all my reports. It contains a confidentiality statement and I don't want any other report information on this page. I created the cover page in a separate report to be used as a subreport in any report that needs the statement included. However, I have searched all over the Web (including this forum) but cannot find any info on how to actually create a cover page. Is this even possible with RS?

Thanks,

Jesse

You can just create a report with no datasets, just static textboxes for the confidentiality text, and use it as the subreport. Are there any other specific things you are looking for?|||

Well, yes. I planned on using it as a subreport. Its just a matter of how to place the subreport on the other reports. Won't the subreport appear on all the other pages of the report.

I guess my actual question is how do I make content appear on first page only and have nothing else on the first page (in effect, a cover page)?

|||You can put the sub-report outside any list,table or matrix - controls at top of the content-pane (maybe the name is "textcontent" in en-version), so it just shows at the beginning of the report. setting "page break at end" for the subreport will take care that only your sub-report cover-page is on the first page..
|||

Yep, that did the trick. Thanks.

Jesse