Friday, February 24, 2012

ASPNETDB relation with my databas

HI!
I have a ASPNETDB as my login databas. but now i want to connect this databas or the aspnet_user table to my table, how do i?
I want to check the username in aspnet_user table and select the same username in my table?

I want to write all sql code in a sql file. so i want to know how i can connect to the sql file from my c# code?

I hope somebody understand me...

Hi sallad88,

I want to write all sql code in a sql file. so i want to know how i can connect to the sql file from my c# code?

Not 100% sure what you mean by this, but if i understand you correct, you can write a stored procedure for this. Since what you want is to "check the username in aspnet_user table and select the same username in my table", you can write your stored procedure like this:

create procedure sp_check_name

as

select * from My_own_table
where Firstnamein

(select username from [asp.net db].dbo.aspnet_users ) // you can access asp.net db this way (specify the database name, schema name, table nameexplicitly)

And in your application, you can bind your sqlcommand to this stored procedure and call executereader function. This will return you desired result set.

Hope my suggestion helps

|||

Yes that was one thing...

And its work fine, I will come back when i can explain the other things better and when iam there in my application...

Thanks for know

No comments:

Post a Comment