VB.NET
Private Function GetData() As String
Dim intDataID As Integer
Dim strFinalizedDate As String = "Not Completed"
Try
intDataID = Int32.Parse(lblDataID.Text)
Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString)
conn.Open()
Using cmd As New SqlCommand("SELECT update_dt FROM table WHERE data_id = " & intDataID, conn)
cmd.CommandType = CommandType.Text
Using reader As SqlDataReader = cmd.ExecuteReader()
If reader.HasRows Then
While reader.Read()
strFinalizedDate = reader("update_dt").ToString()
End While
End If
End Using
End Using
End Using
Return strFinalizedDate
Catch ex As Exception
Throw
End Try
End Function
C#
try {
intDataID = Int32.Parse(lblDataID.Text);
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString)) {
conn.Open();
using (SqlCommand cmd = new SqlCommand("SELECT update_dt FROM table WHERE data_id = " + intDataID, conn)) {
cmd.CommandType = CommandType.Text;
using (SqlDataReader reader = cmd.ExecuteReader()) {
if (reader.HasRows) {
while (reader.Read()) {
strFinalizedDate = reader("update_dt").ToString();
}
}
}
}
}
return strFinalizedDate;
} catch (Exception ex) {
throw;
}
Software engineering and business solutions blog featuring SaaS reviews, automation tools, and business insurance guides. Buyer-intent content designed to drive high-quality traffic and conversions.
Subscribe to:
Post Comments (Atom)
MVC vs MVP vs MVVM Explained for Real Projects
MVC vs MVP vs MVVM Explained for Real Projects Introduction to MVC, MVP, and MVVM Definition of MVC (Model-View-Controller) MVC, wh...
-
The problem was that the remote connection needed to utilize Named Pipes, but in order to utilize Named Pipes both the machine hosting the i...
-
How to clear SharePoint People Picker suggestion cache If you have been SharePoint Site owner long enough, you would have definitely ...
-
Getting the following error (Figure 1): Server Error in '/' Application. ID4014: A SecurityTokenHandler is not registered to ...
No comments:
Post a Comment