Good morning ... I have a defined table (SQL Server 2012) as well;
CREATE TABLE cliente(
id [int] IDENTITY(1,1) NOT NULL,
codigo [varchar](10) NOT NULL,
nombre [varchar](100) NOT NULL,
apellidos [varchar](100) NOT NULL,
direccion [varchar](100) NULL,
ubicaciongeo [geometry] NULL,
telefono [varchar](100) NULL,
email [varchar](100) NULL,
foto [image] NULL,
estado [bit] NOT NULL)
Then I have a form (Windows Forms of Visual Studio 2015 - C #) where that data is inserted.
To insert I use a method and in a stored procedure like this:
string sql = "EXECUTE sp_ClienteInsertar @id, @codigo, @nom, @ape, @dir, @ubigeo, @tel, @ema, @fot, @est";
SqlCommand cdo = new SqlCommand(sql, conexion.SQLServer2012);
cdo.CommandType = CommandType.Text;
cdo.CommandText = sql;
cdo.Parameters.Add("@id", SqlDbType.Int).Value = Codigo;
cdo.Parameters.Add("@codigo", SqlDbType.VarChar, 10).Value = Codigo;
cdo.Parameters.Add("@nom", SqlDbType.VarChar, 100).Value = Nombre;
cdo.Parameters.Add("@ape", SqlDbType.VarChar, 100).Value = Apellidos;
cdo.Parameters.Add("@dir", SqlDbType.VarChar, 100).Value = Direccion;
cdo.Parameters.Add("@ubigeo", SqlDbType....... ).values = UbicacionGeometrica;
cdo.Parameters.Add("@tel", SqlDbType.VarChar, 100).Value = Telefono;
cdo.Parameters.Add("@ema", SqlDbType.VarChar, 100).Value = Email;
cdo.Parameters.Add("@fot", SqlDbType.Image).Value = Foto;
cdo.Parameters.Add("@est", SqlDbType.Bit).Value = Estado;
conexion.SQLServer.Open();
cdo.ExecuteNonQuery();
conexion.SQLServer.Close();
The detail is that I can not save this value (there is no data type):
cdo.Parameters.Add("@ubigeo", SqlDbType....... ).values = UbicacionGeometrica;
And less like in the form in a TextBox enter that data.
My question is:
What value to enter from a TextBox (or other control) and how to save in the SQL Server database?
P.D .: I need to save a geographical position of a client and then trace a guide route with it.