Reputation:
insert(Id, Country, Province, City, Street, PostCode) ->
odbc:start(),
{ok,Seve} = odbc:connect("DSN=test", []),
io:fwrite("~p", odbc:param_query(Seve,"INSERT INTO Address (ID, COUNTRY,
PROVINCE, CITY, STREET, POST_CODE) VALUES(?, ?, ?, ?, ?, ?)"
I want to get input from the user in Erlang and add it to the database.
Now where do I use the values taken at the input?
Upvotes: 1
Views: 73
Reputation: 1362
To take the user of input use following function.
{ok, Input} = io:read("Enter a params: ").
Edit, Make sure Params' input is like [1,3,4,...]
odbc:param_query(Seve,"INSERT INTO Address (ID, COUNTRY,
PROVINCE, CITY, STREET, POST_CODE) VALUES(?, ?, ?, ?, ?, ?)", Params).
Upvotes: 1