Im using Sql_conn package to connect and display data from DB-> https://pub.dev/packages/sql_conn/score
And I wanted to know if I can somehow UPDATE Table Fields with this package (I haven't found any info, there is only Read and Write function)
And if there is no way I can UPDATE tables, how can I do it, is there other solutions?
(P.S: I heard about SQLlite, but don't know what it reperesents)
CodePudding user response:
Try this
///to connect in database:
await SqlConn.connect(
ip: '192.168.0.1',
port: '3306',
databaseName: 'MyDatabase',
username: 'root',
password: 'root');
/// to update a column named col1 with value new value where table id = 1 in table named myTable:
var res = await SqlConn.write("UPDATE myTable SET col1 = 'new value' WHERE id = '1' ");
print(res.toString());
You can read the doc: https://pub.dev/packages/sql_conn/example