Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Problema SqlServer

  1. #1

    Problema SqlServer

    ciao,
    io ho 2 server, uno di test e uno di prova.

    codice:
    private void RiempiGrid()
    		{
    			SqlConnection objConn = new SqlConnection();
    			SqlDataAdapter objCmd;
    			try
    			{
    				objConn.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["conn"];
    
    				string strQUERY = "SELECT * from SMSOut";
    
    				objCmd  = new SqlDataAdapter(strQUERY, objConn);
    				//riempo il dataset
    				DataSet ds = new DataSet();
    				objCmd.Fill(ds, "SMSOut");
    				dgSMS.DataSource = ds.Tables["SMSOut"];
    				dgSMS.DataBind();
    			}
    			catch(Exception ex)
    			{
    				lblErrore.Text = ex.Message + " - " + ex.StackTrace;
    			}
    			finally
    			{
    				objConn.Close();
    			}
    		}

    La connessione la prendo dal web.config
    <add key="conn" value="server=xxxx.4;database=xxx;uid=xxx;pwd=xxx; "></add>

    in testnon ho problemi, quando vado in produzione e al posto dell'IP metto localhost o l'ip della macchina stessa ricevo questo errore:



    Il nome di oggetto 'SMSOut' non č valido.

    at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior behavior) at System.Data.SqlClient.SqlCommand.System.Data.IDbCo mmand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at SMSOut.smsout.RiempiGrid()



    idee in merito?

  2. #2
    SMSOut cosč un'oggetto del DB o un'oggetto del tuo codice?

  3. #3

  4. #4

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.