Issue in getting last inserted Id from table

Dear Folks,

I am trying to save my file data in sql database.
In order to store the data I have created two tables
Table 1. File_Master which have columns , File Name, FileId
Table 2 PageContent which have column ,Page Number, Page Content ,FileId,

FileId in 2nd table is the primary key from 1st table.

But I am not getting Last inserted Id from File_Master
I have used ExecuteNonQuery and Execute Query.

How Can I get last inserted Id from 1st table.

Thanks in advance.

query 1st Table for Max(id)

hi skini76

Thanks for replay,
I tried that but DT is always coming blank.
This is the query in Execute Query activity
“select Max(File_Id) from [dbo].[File_Master]”

put output from this in DT in Message box and it is coming blank all the time.

Have you committed the DB changes before this statement ?

committed you means ,I have already made db changes in SQL server.
Yes I did that.