Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    qt اتصال به بانک اطلاعاتی در

    Persian
    2
    2
    2323
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hamedaz last edited by

      در کیوتی متصل بشم این کدهارونوشتم ولی نشد sql server 2008 میخواستم به

      @
      bool Widget::connection(){
      QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
      db.setDatabaseName("m.mdf");
      if (!db.open()) {
      msg1.setText("error");
      msg1.exec();
      return false;
      }
      return true;

      }
      void Widget::LoadData(){
      QSqlQuery query;
      query.exec("SELECT * FROM m1");
      while (query.next()) {
      QString country = query.value(2).toString();
      ui->label->setText(country);

      }
      }

      @

      collect2:id returned 1 exit status این پیغام خطا رو میده

      1 Reply Last reply Reply Quote 0
      • M
        mohsen last edited by

        p{direction:rtl; text-align:right}. دوست عزیز Sql Server یک سرویس است. در واقع شما باید از طریق اون سرویس به بانک وصل بشی. پس بجای m.mdf در setDatabaseName باید یک Connection String برای Sql Server در ODBC بنویسی.
        انواع Connection String ها رو میتونی در این سایت پیدا کنی http://www.connectionstrings.com/

        1 Reply Last reply Reply Quote 0
        • First post
          Last post