Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 days ago.
Improve this question
Example:
using (var connection = SqlConnection("DBConnectionString"))
{
C = A.SomeMethod();
}
Does Dapper open up a Connection to the Database in the example case even though there are no calls to the database?
Or is the connection only established when the connection is requested IE:
using (var connection = SqlConnection("DBConnectionString"))
{
C = context.Query("SELECT * FROM UserSecrets");
}
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm new to C#.
I have a method that returns an object with the List of objects inside.
0 {{DapperRow, RecordedFormID = 'id1'}} object {Dapper.SqlMapper.DapperRow}
1 {{DapperRow, RecordedFormID = 'id2'}} object {Dapper.SqlMapper.DapperRow}
How can I get those ids as strings?
Here is a screenshot
You can use System.Linq namespace and do this:
yourObject.Select(x => x.RecordedFormID);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
var ticketnumber = TempData["ticketId"] as Ticket;
ticketnumber.TicketId = model.TicketId;
db.SaveChanges();
HttpPostedFileBase file = Request.Files["ImageData"];
UploadRepository service = new UploadRepository();
int i = service.UploadImageInDataBase(file, model);
I have the value inside my tempdata but when i try to assign the value of it to the model value it doesnt save and even in debug it tells me the value hasnt changed so i just dont get what i am doing wrong.
You need to change the assignment:
From:
ticketnumber.TicketId = model.TicketId;
To:
model.TicketId = ticketnumber.TicketId;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How do I convert this the time the computer has been to sleep for (here called 'offTime') into an integer (in terms of minutes)?
`DateTime timeOnSleep = DateTime.Now;`
`Application.SetSuspendState(PowerState.Suspend, true, true);`
`DateTime timeOnWake = DateTime.Now;`
`System.TimeSpan offTime = timeOnWake - timeOnSleep;`
TimeSpan time = timeOnWake - timeOnSleep;
var hours = time.TotalHours;
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have connected to my database using Data Connection Server Explorer and the same is added to my web.config as well. Now can someone tell me how to query it?
Sure, you could do this:
using (SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["key_of_element"]))
{
c.Open();
using (SqlCommand cmd = new SqlCommand("SELECT * FROM Table"))
{
var reader = cmd.ExecuteReader();
while (reader.Read())
{
// do something with the data
}
}
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm going to send back data to my sms gateway.first i have a querystring like this.
string mobileNo = Request.QueryString["msisdn"];
int dest = int.Parse(Request.QueryString["shortcode"].ToString());
string messageIn = Request.QueryString["msg"];
string operatorNew = Request.QueryString["operator"];
Then i'm going to assign a variables to it.
public void sendReply(string messageOut)
{
messageOut = "http://mygateway.com/api/mt?msisdn=mobileNo&body=msg&sender=shortcode&key=nvqow9rhfp&product_id=2116&operator=OperatorNew&country=us";
}
But i'm getting operator assignment error..
Check this.This parameter is wrong.this param not supplied.
&body=msg
Please verify your Key & Product id with the gateway owners.