sql server - Storing the url in SQLSERVER 2005 using C# code(data sets) -


I was trying to click the URL button using the following code. There was no error but the required url is not sroeing in my column field (I used ntext data tap for it). Help me if there was some mistake in my code

  public partial square _Default: System.Web.UI.Page {protected sender page_load (object sender, EventErgus E) {} database string connection = "data source =. \\ scllexpress2005; initial catalog = PtsKuratlas; integrated security = true"; Public Zero Startext (String TSTT) SqlConnection conn = New SqlConnection (connection); To store data data and manipulate data, // dataset object DataSet myDataSet = new DataSet (); SQL SqlDataAdapter myDataAdapter = // data adapter to execute new SqlDataAdapter ("SELECT * FROM gti_analytics", conn); MyDataAdapter.Fill (myDataSet, "gti_analytics"); MyDataAdapter.InsertCommand = new SqlCommand ("gti_analytics [links] include values ​​[txt]"); } Secure Zero Button 1_Click (Object Sender, EventArgs E) {string text = "http://google.com"; Storetxt (text); }}  

The problem is that you are not actually executing commands against the database Are there. You are defining an inclusion commm to use, but it is not being executed.

Based on that code, I do not know that you need to use DataAdaptor / Dataset in any way, just use a SqlCommand Insert, which is slightly more light like this:

  Public Zero StottTax (String Text) {connection to connection string connection = "data source =. \\ scllexpress2005; initial catalog = PtsKuratlas; integrated security = true"; SqlConnection conn = faucet; SqlCommand CMD = Faucet; Try {conn = new SqlConnection (connection); CMD = New SQL Commands ("Include in GTANETIX (Links) Prices (@ Link)", Con); Cmd.CommandType = CommandType.Text; Cmd.Parameters.AddWithValue ("@ Link", txt); Conn.Open (); Cmd.ExecuteNonQuery (); } Hold {// Handle exception}} Finally {if (CMD! = Null) cmd. (); If (conn! = Null) {if (conn.State == ConnectionState.Open) conn.Close (); Conn.Dispose (); }}}  

I would also recommend not using ntext for it in your DB. If you really need Unicode support, then use nvarchar which can go upto 4000 characters pre-sql 2005 or nvarchar (max), which can store nitext next to SQL 2005. If you do not need Unicode support, use varchar instead (8000 characters pre-sql 2005, with SQL 2005 since VARCHAR (MAX) is the same as text)


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -