小编Fad*_*lil的帖子

如何在web.config文件中更改我的asp.net网站的默认时区

我正在尝试更改我的asp.net网站的默认时区,我尝试了以下代码但它没有用

<system.web>
<globalization culture="ar-JO" uiCulture="ar-JO" />
<httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" />
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
<webServices>
  <protocols>
    <add name="HttpGet"/>
    <add name="HttpPost"/>
  </protocols>
</webServices>
Run Code Online (Sandbox Code Playgroud)

asp.net timezone web-config c#-4.0

8
推荐指数
2
解决办法
2万
查看次数

如何使用SQL参数从SQL Server获取数据集

我正在研究C#项目,我是这项技术的新手.

我想从SQL Server 2008中读取一些数据,然后编写以下代码

public User select(string username, string password)
{
    string connection = ConfigurationManager.ConnectionStrings["lawyersDBConnectionString"].ConnectionString.ToString();
    string sql = string.Format("select * from users where userName = '{0}' and password = '{1}'", username, password);

    SqlConnection con = new SqlConnection();            
    con.ConnectionString = connection;

    DataSet ds = new DataSet();
    SqlDataAdapter da = new SqlDataAdapter(sql, con);            

    User user = new User();
    DataRow dr;

    try
    {
            da.Fill(ds);
            dr = ds.Tables[0].Rows[0];

            user.Id = Convert.ToInt16(dr["userID"]);                
            user.FirstName = (string)dr["firstName"];
            user.LastName = (string)dr["lastName"];
            user.Email = (string)dr["email"];
            user.Username = (string)dr["userName"];
            user.Password …
Run Code Online (Sandbox Code Playgroud)

c# sql sql-server sql-injection sqlparameter

4
推荐指数
1
解决办法
2万
查看次数

如何在android中每5秒调用一次方法?

我在一个应用程序中工作,当我选择(自动发送按钮打开)时,该应用程序必须每5秒向服务器发送一个GPS位置.我是android的新手,所以我不知道如何制作开/关按钮,如何在按钮打开时调用每5秒发送一次数据的方法.

它必须每5秒调用一次的方法:

public void postData() throws ClientProtocolException, IOException, Exception {


    String longitude="UK";
    String latitude="UK";
    String altitiude="UK";
    String time="";
    String speed="";

    getCurrentLocation(); // gets the current location and update mobileLocation variables

    if (mobileLocation != null) {
        locManager.removeUpdates(locListener); // This needs to stop getting the location data and save the battery power.

         longitude = ""+mobileLocation.getLongitude();
         latitude = "" + mobileLocation.getLatitude();
         altitiude = "" + mobileLocation.getAltitude();
        String accuracy = "Accuracy" + mobileLocation.getAccuracy();
        time = "" + mobileLocation.getTime();
         speed =""+ (int)(4*mobileLocation.getSpeed());

        editTextShowLocation.setText(longitude + "\n" …
Run Code Online (Sandbox Code Playgroud)

java android android-widget android-layout

2
推荐指数
1
解决办法
2万
查看次数

这个SQL更新版本中的错误是什么

我有更新到数据库表的方法,但是当我调用它时,我有一个异常"语法不正确'('."

这是方法

 internal Boolean update(int customerID,int followingID, string fullName, string idNumber, string address, string tel, string mobile1, string mobile2, string email, string customerComment, DateTime timeStamp)
     {
         string sqlStatment = "update customers set (followingID, fullName,idNumber,address,tel,mobile1,mobile2,email,customerComment,timeStamp) = (@followingID, @fullName,@idNumber,@address,@tel,@mobile1,@mobile2,@email,@customerComment,@timeStamp) where customerID=@customerID";

         SqlConnection con = new SqlConnection();
         con.ConnectionString = connection;
         SqlCommand cmd = new SqlCommand(sqlStatment, con);

         cmd.Parameters.AddWithValue("@customerID", customerID);
         cmd.Parameters.AddWithValue("@followingID", followingID);
         cmd.Parameters.AddWithValue("@fullName", fullName);
         cmd.Parameters.AddWithValue("@idNumber", idNumber);
         cmd.Parameters.AddWithValue("@address", address);
         cmd.Parameters.AddWithValue("@tel", tel);
         cmd.Parameters.AddWithValue("@mobile1", mobile1);
         cmd.Parameters.AddWithValue("@mobile2", mobile2);
         cmd.Parameters.AddWithValue("@email", email);
         cmd.Parameters.AddWithValue("@customerComment", customerComment);
         cmd.Parameters.AddWithValue("@timeStamp", timeStamp);


         bool success = false;
         try …
Run Code Online (Sandbox Code Playgroud)

sql sql-server c#-4.0 qsqlquery

0
推荐指数
2
解决办法
129
查看次数