Saturday, October 22, 2016

To find how many tables,procedure etc are there in the SqlServer

To check how many tables are there in the DataBase:-

select * from sys.objects where sys.objects.type = 'u'

Here is a list of other object types you can search for as well:
AF: Aggregate function (CLR)
C: CHECK constraint
D: Default or DEFAULT constraint
F: FOREIGN KEY constraint
L: Log
FN: Scalar function
FS: Assembly (CLR) scalar-function
FT: Assembly (CLR) table-valued function
IF: In-lined table-function
IT: Internal table
P: Stored procedure
PC: Assembly (CLR) stored-procedure
PK: PRIMARY KEY constraint (type is K)
RF: Replication filter stored procedure
S: System table
SN: Synonym
SQ: Service queue
TA: Assembly (CLR) DML trigger
TF: Table function
TR: SQL DML Trigger
TT: Table type
U: User table
UQ: UNIQUE constraint (type is K)
V: View
X: Extended stored procedure

Sunday, October 16, 2016

Solution ( user created sql function or tabled valued function is not visible in the edmx)

I faced a problem with the table valued function or user created function when i was trying to add it to the edmx. The problem that i was having a function in the sqlserver but when i tried to update the edmx to add the same function into it.
 The function name was not visible.I searched a lot over the net about this but could not able to find the solution but finally. I got it how to do it.



 












As the above image shows that i was targeting the .net framework 4 just change it to 4.5 and it worked for me 


 












 And now in the below image you can see that i was able to see the function name which i wanted to add to the edmx 


Different ways to display the message from code behind

1. ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", "<script>alert('Enter 

your message');</script>", false);

2Response.Write("<script>alert('hello world');</script>");

The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.

public List<data>GetData()
        {

            return (
                from ud in dbcontext.userdetails
                join td in dbcontext.taskdetails
                on new
                {
                   ud.uid ,
                }
                equals new
                {
                   td.uid.Value ,
                }
                select new data
                {
                    name = td.name,
                    amount = td.amount
                }

                ).ToList();

        }


Solution :- 

public List<data>GetData()
        {

            return (
                from ud in dbcontext.userdetails
                join td in dbcontext.taskdetails
                on new
                {
                   uid =  ud.uid ,
                }
                equals new
                {
                  uid = td.uid.Value ,
                }
                select new data
                {
                    name = td.name,
                    amount = td.amount
                }

                ).ToList();
        }

Git Commands

Git Version   To check the git version Git -v       Git Clone To clone the repository, use the following command: Git clone [u...