TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shreyas adikumar
NA
85
10.2k
how to combine two different database server
Feb 12 2020 11:15 PM
hi i tried to join the two different databse sever into single query in asp.net.I am geeting can anyone help me regarding this it will be a great help.
SqlConnection con =
new
SqlConnection(str1);
//SqlConnection con1 = new SqlConnection(constr);
DateTime DATEFROM = System.DateTime.Today;
string
DFrom = Convert.ToString(DATEFROM.ToString(
"dd/MM/yyyy"
, CultureInfo.InvariantCulture));
string
com =
" select count (*) as counts FROM [PVQC2].[dbo].[Man_Allocation] inner JOIN [Man_Allocation1].[dbo].[Mx_VEW_APIDailyAttendance] ON [Man_Allocation].[Emp_Id] = [Mx_VEW_APIDailyAttendance]. UserID where [Mx_VEW_APIDailyAttendance].UserID='"
+ lblUserId.Text +
"' and [Mx_VEW_APIDailyAttendance].ProcessDate='"
+ DFrom +
"'"
;
SqlDataAdapter adpt =
new
SqlDataAdapter(com, con);
DataTable dt =
new
DataTable();
adpt.Fill(dt);
lblp2.Text = dt.Rows[0][
"COUNTS"
].ToString();
Error occured is
Invalid object name 'PVQC2.dbo.Man_Allocation'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'PVQC2.dbo.Man_Allocation'.
Source Error:
Line 87: Line 88: DataTable dt = new DataTable(); Line 89: adpt.Fill(dt); Line 90: lblp2.Text = dt.Rows[0]["COUNTS"].ToString(); Line 91:
Source File: d:\PreethamFiles\PVQCrework\PVQC_WEB\UI\Master\HCM\MasterEmployee.aspx.cs Line: 89
Reply
Answers (
2
)
change values in json file
MVC Tutorial for Beginners