C連線資料庫,附近有問題

2023-01-19 05:20:29 字數 580 閱讀 5900

1樓:匿名使用者

newsid 沒有取到值~

2樓:寂靜_夜晚

string strcom = "select biaoti,zhaizi,neirong,img,counter,shijian from news where select biaoti,zhaizi,neirong,img,counter,shijian from news where id= '' ", newsid );

字串拼接使用 string.format();

//你的**錯在 where + newsid + " ' " ;//應該加上單引號

3樓:合亞眼鏡網

你的newsid是字串型別,你要這樣寫=『「+newsid,如果你要那樣寫的話先把字串轉換為int型別。

c連線資料庫的問題

連線字串有點不一樣 server localhost database 資料庫名 uid sa pwd 這個可以通用 sqlconnection connstr new sqlconnection server localhost initial catalog 資料庫名 integrated se...

怎麼用c做登入介面來連線資料庫啊

什麼意思?是建一個登入介面還是隻是如何在winform中連線 資料庫?一般來講 1 匯入名稱空間 using system.data.sqlclient 連線sqlserver 資料庫專用 2 建立連線 sqlconnection lo conn new sqlconnection server 伺...

用c語言怎麼連線資料庫呢,用C語言怎麼實現與資料庫的連線

25.2.2.c api函式概述 這裡歸納了c api可使用的函式,並在下一節詳細介紹了它們。請參見25.2.3節,c api函式描述 函式 描述 mysql affected rows 返回上次update delete或insert查詢更改 刪除 插入的行數。mysql autocommit 切...