Вопрос

Through designer I have created a typed data set and included stored procedures for insert / update / delete. The problem is now, how to call those stored procedures? How to actually change data in database this way? And how to receive answer from db (number of rows changed)?

enter image description here

Это было полезно?

Решение 2

I found out that far easiest way is through designer - create table adapter and simply set it to call stored procedure. No extra typing needed, arguments are also added to procedure call.

Другие советы

try this for get data from database. DataSet ds = new DataSet("dstblName"); using(SqlConnection conn = new SqlConnection("ConnectionString")) {
SqlCommand sqlComm = new SqlCommand("spselect", conn);
sqlComm.Parameters.AddWithValue("@parameter1", parameter1value); sqlComm.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = sqlComm; da.Fill(ds); }

Similarly you need to call "spdelte" etc.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top