Ir para conteúdo
Fórum Script Brasil

hpires24

Membros
  • Total de itens

    37
  • Registro em

  • Última visita

Tudo que hpires24 postou

  1. hpires24

    Excluir Datagrid

    O erro já esta resolvido o que eu fiz foi o seguinte no codigo aspx estava: <asp:ButtonColumn ButtonType= "PushButton" Text="Excluir" HeaderText="Excluir" CommandName="Delete"></asp:ButtonColumn> então eu akterei para: <asp:ButtonColumn ButtonType= "LinkButton" Text="Excluir" HeaderText="Excluir" CommandName="Delete"></asp:ButtonColumn> agora tem um Link e não um PushButton o metodo que estava associado era o referido: Public Sub DataGridTecnologias_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then 'Referencie o controle LinkButton Dim deleteButton As LinkButton = e.Item.Cells(7).Controls(0) 'incluimos o gerenciador de evento onclick deleteButton.Attributes("onclick") = "java script:return confirm('Tem certeza que deseja excluir a tecnologia de código #" & DataBinder.Eval(e.Item.DataItem, "ID_TECNOLOGIAS") & "?')" End If End Sub so que eu pretendia mesmo ter o Botao e não o Link alguém sabe como alterar isso? Por favor me ajudem
  2. hpires24

    Excluir Datagrid

    Bao tarde a todos, não sei se me poderiam ajudar estou a tentar excluir um registo de uma base de dados dentro duma datagrid mas estou com um erro se eu colocar no codigo aspx o seguinte comando OnItemDataBound="DataGridTecnologias_ItemDataBound" que vai executar este metodo: Public Sub DataGridTecnologias_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then 'Referencie o controle LinkButton Dim deleteButton As LinkButton = e.Item.Cells(0).Controls(0) 'incluimos o gerenciador de evento onclick deleteButton.Attributes("onclick") = "java script:return confirm('Tem certeza que deseja excluir o produto de código #" & DataBinder.Eval(e.Item.DataItem, "ID_TECNOLOGIAS") & "?')" End If End Sub se eu fizer o excluir sem executar este metodo ele exclui correcto da base de dados mas eu gostaria de executar este java script de confirmação mas da este erro: System.InvalidCastException: Specified cast is not valid. at gaapi.tecnologias.DataGridTecnologias_ItemDataBound(Object sender, DataGridItemEventArgs e) in c:\inetpub\wwwroot\gaapi\tecnologias.aspx.vb:line 304 at System.Web.UI.WebControls.DataGrid.OnItemDataBound(DataGridItemEventArgs e) at System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) at System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) at System.Web.UI.WebControls.BaseDataList.DataBind() at gaapi.tecnologias.BinData() in c:\inetpub\wwwroot\gaapi\tecnologias.aspx.vb:line 249 os dois erros que são mencionados são no metodo acima mencionado e no seguinte: Public Sub BinData() Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim oDadapter As SqlDataAdapter Dim oDataSet As DataSet sqlString = "usp_exibirTenologias" Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure 'Cria um novo objeto OleDbDataAdapter oDadapter = New SqlDataAdapter(sqlString, conn) 'Preenche o DataSet com o conteúdo selecionado da tabela oDataSet = New DataSet oDadapter.Fill(oDataSet, "TECNOLOGIAS") dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) oDadapter = Nothing 'exibe uma visão customizada da tabela inserida no dataset DataGridTecnologias.DataSource = oDataSet.Tables("TECNOLOGIAS").DefaultView DataGridTecnologias.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try End Sub
  3. Este problema esta resolvido de inserir num formulario com uma listbox nesse mesmo formulario agora a minha duvida prende-se com o facto de eu querer por exemplo ao estar a inserir os dados no formulario por vezes não seleccionar nada no campo que comtem a listbox ou seja por exemplo a listbox tem seleciona opção e eu queria deixar ficar assim e não selecionar nenhuma opção e na base dados claro inserir-me null não consigo fazer isso alguém me podia dar uma ajuda obrigado a todos desde já
  4. Obrigado Graymalkin mas relamente eu estava a passar mal o prametro, eu vou colocar o novo codigo que alterei para a resolução do problema em causa pois o mesmo problema poderá surgir a mais alguém e fica a dica:) conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure <b> cmd.Parameters.Add(New SqlParameter("@projetos", CInt(ListboxProjectos.SelectedValue))) cmd.Parameters.Add(New SqlParameter("@unidade", CInt(ListBoxUnidades.SelectedValue))) </b> cmd.Parameters.Add(New SqlParameter("@nome", TextBoxNomeTecnologia.Text)) cmd.Parameters.Add(New SqlParameter("@descricao", TextBoxDescricaoTecnologia.Text)) cmd.Parameters.Add(New SqlParameter("@eventores", TextboxEventoresTecnologia.Text))
  5. Boa noite a todos, O que eu pretendo épreencher um formulario mas esse formulário contem uma ListBox como segue no codigo abaixo: <%@ Register TagPrefix="uc1" TagName="topo" Src="topo.ascx" %> <%@ Page Language="vb" AutoEventWireup="false" Codebehind="tecnologias.aspx.vb" Inherits="gaapi.tecnologias"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>proj</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <uc1:topo id="Topo1" runat="server" DESIGNTIMEDRAGDROP="94"></uc1:topo> <table height="500" cellSpacing="1" cellPadding="0" width="100%" align="center" border="0"> <tr vAlign="top"> <td> <table height="300" cellSpacing="1" cellPadding="0" width="100%" align="center" border="1"> <tr> <td vAlign="top" align="center" bgColor="#ffffff"><br> <span class="verdana10"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td bgColor="#f9e3a2" height="20">Tecnologias</td> </tr> </table> <br> </span> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td align="left" width="150" bgColor="#c4d8ea" height="20">&nbsp;&nbsp;Dados das tecnologias</td> </tr> <tr align="center"> <td bgColor="#ffffff" height="20"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="0"> <tr> <td align="right">&nbsp;</td> <td>&nbsp;</td> </tr> <td align="right" width="150" height="20"><asp:label id="LabelProjectos" runat="server">Projectos:</asp:label></td> <td height="20"><asp:listbox id="ListboxProjectos" runat="server" Width="192px" Height="64px" AutoPostBack="True"></asp:listbox></td> </tr> <tr> <td align="right" width="150" height="20"><asp:label id="LabelIdUnidade" runat="server">Unidade:</asp:label></td> <td height="20"><asp:listbox id="ListBoxUnidades" runat="server" Width="192px" Height="64px"></asp:listbox></td> </tr> <tr> <td style="HEIGHT: 24px" align="right" height="24"><asp:label id="LabelNomeTecnologia" runat="server"> Nome:</asp:label></td> <td style="HEIGHT: 24px" height="24"><asp:textbox id="TextBoxNomeTecnologia" runat="server" Width="320px"></asp:textbox></td> </tr> <tr> <td align="right" height="20"><asp:label id="LabeldescricaoTecnologia" runat="server">Descrição:</asp:label></td> <td height="20"><asp:textbox id="TextBoxDescricaoTecnologia" runat="server" Width="320px"></asp:textbox>&nbsp; </td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelEventoresTecnologia" runat="server"> Eventores:</asp:label></td> <td height="20"><asp:textbox id="TextboxEventoresTecnologia" runat="server" Width="256px"></asp:textbox>&nbsp; </td> </tr> </table> </td> </tr> </table> <P><asp:button id="ButtonEnviarTecnologia" runat="server" Text="Enviar"></asp:button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:button id="ButtonCancelar" runat="server" Text="Cancelar"></asp:button>&nbsp; </P> </td> </tr> <tr align="center"> <td> <P>&nbsp;</P> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td bgColor="#f9e3a2" height="20">Actualizar Tecnologias</td> </tr> </table> <br> </SPAN> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td align="left" width="150" bgColor="#c4d8ea" height="20">&nbsp;&nbsp;Dados das Técnoligias </td> </tr> <tr align="center"> <td bgColor="#ffffff" height="20"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="0"> </table> <asp:datagrid id="DataGridTecnologias" runat="server" Width="100%" Height="100%" AutoGenerateColumns="False" Font-Names="Verdana" BackColor="#ffffff" BorderColor="DeepSkyBlue" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" MaintainState="false" DataKeyField="ID_TECNOLOGIAS" OnEditCommand="DataGridTecnologias_Editar" OnCancelCommand="DataGridTecnologias_Cancelar" OnUpdateCommand="DataGridTecnologias_Actualizar"> <HeaderStyle BackColor="#f9e3a2"></HeaderStyle> <Columns> <asp:EditCommandColumn ButtonType="PushButton" EditText="Editar" UpdateText="Actualizar" CancelText="Cancelar" ItemStyle-Height="100%"></asp:EditCommandColumn> <asp:BoundColumn DataField="ID_TECNOLOGIAS" HeaderText="Codigo" ReadOnly="True"></asp:BoundColumn> <asp:BoundColumn DataField="ID_PROJECTOS" HeaderText="Projecto"></asp:BoundColumn> <asp:BoundColumn DataField="ID_UNIDADE" HeaderText="Unidade"></asp:BoundColumn> <asp:BoundColumn DataField="NOME_TECNOLOGIA" HeaderText="Nome"></asp:BoundColumn> <asp:BoundColumn DataField="DESCRICAO_TECNOLOGIA" HeaderText="Descrição"></asp:BoundColumn> <asp:BoundColumn DataField="EVENTORES_TECNOLOGIA" HeaderText="Eventor"></asp:BoundColumn> </Columns> </asp:datagrid></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </form> </body> </HTML> e os dados dessa lisbox estao numa tabela que se chama unidades e eu pretendo inserir os dados numa tabela que se chama tecnologia e tem como chave estrangeira o id_unidades da tabela unidades então eu consigo ver os dados na listbox com o seguinte codigo: Imports System.Data Imports System.Data.OleDb Imports System.Data.SqlClient Imports System.Data.OleDb.OleDbParameterCollection Public Class tecnologias Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Protected WithEvents ButtonCancelar As System.Web.UI.WebControls.Button Protected WithEvents LabelIdUnidade As System.Web.UI.WebControls.Label Protected WithEvents LabelNomeTecnologia As System.Web.UI.WebControls.Label Protected WithEvents TextBoxNomeTecnologia As System.Web.UI.WebControls.TextBox Protected WithEvents LabeldescricaoTecnologia As System.Web.UI.WebControls.Label Protected WithEvents TextBoxDescricaoTecnologia As System.Web.UI.WebControls.TextBox Protected WithEvents LabelEventoresTecnologia As System.Web.UI.WebControls.Label Protected WithEvents TextboxEventoresTecnologia As System.Web.UI.WebControls.TextBox Protected WithEvents ListBoxUnidades As System.Web.UI.WebControls.ListBox Protected WithEvents DataGridTecnologias As System.Web.UI.WebControls.DataGrid Protected WithEvents ButtonEnviarTecnologia As System.Web.UI.WebControls.Button Protected WithEvents LabelProjectos As System.Web.UI.WebControls.Label Protected WithEvents ListboxProjectos As System.Web.UI.WebControls.ListBox 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then carrega_lista() carrega_lista_Projectos() ListBoxUnidades.SelectedIndex = 0 ListboxProjectos.SelectedIndex = 0 BinData() End If End Sub Private Sub ButtonEnviarTecnologia_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEnviarTecnologia.Click If Page.IsValid Then Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader sqlString = "usp_inserirTecnologia" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add(New SqlParameter("@projetos", ListboxProjectos)) 'cmd.Parameters.Add("@projetos", SqlDbType.Int) 'cmd.Parameters("@projetos").Value = ListboxProjectos cmd.Parameters.Add(New SqlParameter("@unidade", ListBoxUnidades)) 'cmd.Parameters.Add("@unidade", SqlDbType.Int) 'cmd.Parameters("@unidade").Value = ListBoxUnidades cmd.Parameters.Add(New SqlParameter("@nome", TextBoxNomeTecnologia.Text)) cmd.Parameters.Add(New SqlParameter("@descricao", TextBoxDescricaoTecnologia.Text)) cmd.Parameters.Add(New SqlParameter("@eventores", TextboxEventoresTecnologia.Text)) dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) TextBoxNomeTecnologia.Text() = "" TextBoxDescricaoTecnologia.Text() = "" TextboxEventoresTecnologia.Text() = "" 'dgInscritos.DataSource = dr 'dgInscritos.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try BinData() 'carrega_lista() 'carrega_lista_Projectos() End If End Sub Public Sub carrega_lista() Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim idunidade As Integer sqlString = "select * From gaapi.UNIDADES" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) 'cmd.CommandType = CommandType.StoredProcedure cmd.CommandType = CommandType.Text dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ListBoxUnidades.DataValueField = "ID_UNIDADE" ListBoxUnidades.DataTextField = "DESCRICAO_UNIDADE" ListBoxUnidades.DataSource = dr ListBoxUnidades.DataBind() dr.Close() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try 'BinData() End Sub Private Sub ListBoxUnidades_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBoxUnidades.SelectedIndexChanged Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim txtproj As Char Dim txtIdunid As Integer Dim txtnome As Char Dim txtdescr As Char Dim txtevent As Char sqlString = "insert into gaapi.Tecnologias (ID_PROJECTOS, ID_UNIDADE, NOME_TECNOLOGIA, DESCRICAO_TECNOLOGIA, EVENTORES_TECNOLOGIA) values (@projetos, @unidade, @nome, @descricao, @eventores)" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) 'cmd.CommandType = CommandType.StoredProcedure cmd.CommandType = CommandType.Text dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) While dr.Read() With dr txtproj = .Item("ID_PROJECTOS") txtIdunid = .Item("ID_UNIDADE") txtnome = .Item("NOME_TECNOLOGIA") txtdescr = .Item("DESCRICAO_TECNOLOGIA") txtevent = .Item("EVENTORES_TECNOLOGIA") End With End While Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try 'BinData() End Sub Public Sub carrega_lista_Projectos() Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim idunidade As Integer sqlString = "select * From gaapi.PROJECTOS" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) 'cmd.CommandType = CommandType.StoredProcedure cmd.CommandType = CommandType.Text dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ListboxProjectos.DataValueField = "ID_PROJECTOS" ListboxProjectos.DataTextField = "TITULO_PROJECTO" ListboxProjectos.DataSource = dr ListboxProjectos.DataBind() dr.Close() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try 'BinData() End Sub Private Sub ListboxProjectos_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListboxProjectos.SelectedIndexChanged Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim txtproj As Char Dim txtIdunid As Integer Dim txtnome As Char Dim txtdescr As Char Dim txtevent As Char sqlString = "insert into gaapi.Tecnologias (ID_PROJECTOS, ID_UNIDADE, NOME_TECNOLOGIA, DESCRICAO_TECNOLOGIA, EVENTORES_TECNOLOGIA) values (@projetos, @unidade, @nome, @descricao, @eventores)" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) 'cmd.CommandType = CommandType.StoredProcedure cmd.CommandType = CommandType.Text dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) While dr.Read() With dr txtproj = .Item("ID_PROJECTOS") txtIdunid = .Item("ID_UNIDADE") txtnome = .Item("NOME_TECNOLOGIA") txtdescr = .Item("DESCRICAO_TECNOLOGIA") txtevent = .Item("EVENTORES_TECNOLOGIA") End With End While Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try 'BinData() End Sub 'DATA GRID TECNOLOGIAS Public Sub BinData() Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim oDadapter As SqlDataAdapter Dim oDataSet As DataSet sqlString = "usp_exibirTenologias" Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure 'Cria um novo objeto OleDbDataAdapter oDadapter = New SqlDataAdapter(sqlString, conn) 'Preenche o DataSet com o conteúdo selecionado da tabela oDataSet = New DataSet oDadapter.Fill(oDataSet, "Tecnologias") dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) oDadapter = Nothing 'exibe uma visão customizada da tabela produtos inserida no dataset DataGridTecnologias.DataSource = oDataSet.Tables("TECNOLOGIAS").DefaultView DataGridTecnologias.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try End Sub Public Sub DataGridTecnologias_Editar(ByVal Source As Object, ByVal E As DataGridCommandEventArgs) DataGridTecnologias.EditItemIndex = E.Item.ItemIndex BinData() End Sub Public Sub DataGridTecnologias_Cancelar(ByVal Source As Object, ByVal E As DataGridCommandEventArgs) DataGridTecnologias.EditItemIndex = -1 BinData() End Sub Public Sub DataGridTecnologias_Actualizar(ByVal Source As Object, ByVal E As DataGridCommandEventArgs) Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader Dim idtecnologia As Integer idtecnologia = DataGridTecnologias.DataKeys(E.Item.ItemIndex) Dim txtproj As TextBox = E.Item.Cells(2).Controls(0) Dim txtunid As TextBox = E.Item.Cells(3).Controls(0) Dim txtnome As TextBox = E.Item.Cells(4).Controls(0) Dim txtdescric As TextBox = E.Item.Cells(5).Controls(0) Dim txtevent As TextBox = E.Item.Cells(6).Controls(0) sqlString = "usp_UpdateTecnologias" Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure 'cmd.CommandType = CommandType.Text cmd.Parameters.Add("@idtecnolo", SqlDbType.Int) cmd.Parameters("@idtecnolo").Value = idtecnologia cmd.Parameters.Add("@idproj", SqlDbType.Int) cmd.Parameters("@idproj").Value = txtproj.Text cmd.Parameters.Add("@idunid", SqlDbType.Int) cmd.Parameters("@idunid").Value = txtunid.Text cmd.Parameters.Add("@nometecnolo", SqlDbType.Text) cmd.Parameters("@nometecnolo").Value = txtnome.Text cmd.Parameters.Add("@desctecnolo", SqlDbType.Text) cmd.Parameters("@desctecnolo").Value = txtdescric.Text cmd.Parameters.Add("@eventotecnolo", SqlDbType.Text) cmd.Parameters("@eventotecnolo").Value = txtevent.Text cmd.ExecuteNonQuery() Catch ex As Exception Response.Write(ex.ToString) Finally conn.Close() End Try DataGridTecnologias.EditItemIndex = -1 BinData() End Sub End Class Só que quando eu faço para enviar or dados da um erro que é o seguinte: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) at System.String.Format(IFormatProvider provider, String format, Object[] args) at System.Data.Res.GetString(CultureInfo culture, String name, Object[] args) at System.Data.Common.ADP.UnknownDataType(Type dataType) at System.Data.SqlClient.MetaType.GetMetaType(Object value) at System.Data.SqlClient.SqlParameter.SetTypeInfoFromComType(Object value) at System.Data.SqlClient.SqlParameter.set_Value(Object value) at System.Data.SqlClient.SqlParameter..ctor(String parameterName, Object value) at gaapi.tecnologias.ButtonEnviarTecnologia_Click(Object sender, EventArgs e) in o que eu penso é que ao estar a enviar os dados existe alguma coisa que eu estou a fazer de errado ao inserir no formulario os dados da listbox não será? penso ser neste trecho de codigo: Private Sub ButtonEnviarTecnologia_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEnviarTecnologia.Click If Page.IsValid Then Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader sqlString = "usp_inserirTecnologia" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add(New SqlParameter("@projetos", ListboxProjectos)) 'cmd.Parameters.Add("@projetos", SqlDbType.Int) 'cmd.Parameters("@projetos").Value = ListboxProjectos cmd.Parameters.Add(New SqlParameter("@unidade", ListBoxUnidades)) 'cmd.Parameters.Add("@unidade", SqlDbType.Int) 'cmd.Parameters("@unidade").Value = ListBoxUnidades cmd.Parameters.Add(New SqlParameter("@nome", TextBoxNomeTecnologia.Text)) cmd.Parameters.Add(New SqlParameter("@descricao", TextBoxDescricaoTecnologia.Text)) cmd.Parameters.Add(New SqlParameter("@eventores", TextboxEventoresTecnologia.Text)) dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) TextBoxNomeTecnologia.Text() = "" TextBoxDescricaoTecnologia.Text() = "" TextboxEventoresTecnologia.Text() = "" 'dgInscritos.DataSource = dr 'dgInscritos.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try BinData() 'carrega_lista() 'carrega_lista_Projectos() End If End Sub Será qnao é detste modo que eu passo os dados que estao carregados na listbox: cmd.Parameters.Add(New SqlParameter("@projetos", ListboxProjectos))??? Agradecia uma ajuda
  6. hpires24

    Erros No Asp.net

    Eu penso que a melhor forma seria meter uma mensgem de erro no seu projecto do genero: Response.Write(ex.ToString)
  7. hpires24

    Update Datagrid

    erro resolvido eu estava a chamr o command como stored procedure e como text e claro não pdoeria ser obrigado a todos
  8. hpires24

    Update Datagrid

    Boas tardes amigos poderiam ajudar-me no seguinte? vou esclarecer minha duvida: Eu estou tentando fazer a actualizados de dados de uma Datagrid os dados são exibidos no browser mas quando eu faço actualizar os dados da o seguinte erro: System.InvalidCastException: Object must implement IConvertible. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at gaapi.unidades.DataGridUnidades_Actualizar(Object Source, DataGridCommandEventArgs E) in c:\inetpub\wwwroot\gaapi\unidades.aspx.vb:line 245 o codigo que eu estou a utilizar para fazer o update da datagrid é: Public Sub DataGridUnidades_Actualizar(ByVal Source As Object, ByVal E As DataGridCommandEventArgs) Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand 'Dim txtUidade As TextBox = E.Item.Cells(1).Controls(0) Dim idunidade As Integer idunidade = DataGridUnidades.DataKeys(E.Item.ItemIndex) Dim txtdescricao As TextBox = E.Item.Cells(2).Controls(0) Dim txttelefone As TextBox = E.Item.Cells(3).Controls(0) Dim txtmail As TextBox = E.Item.Cells(4).Controls(0) Dim txtmissao As TextBox = E.Item.Cells(5).Controls(0) Dim txtobjectivo As TextBox = E.Item.Cells(6).Controls(0) sqlString = "usp_UpdateUnidades" Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure cmd.CommandType = CommandType.Text cmd.Parameters.Add("@idunid", SqlDbType.Int) cmd.Parameters("@idunid").Value = idunidade cmd.Parameters.Add("@descr", SqlDbType.Char) cmd.Parameters("@descr").Value = txtdescricao cmd.Parameters.Add("@tele", SqlDbType.Int) cmd.Parameters("@tele").Value = txttelefone cmd.Parameters.Add("@mail", SqlDbType.Char) cmd.Parameters("@mail").Value = txtmail cmd.Parameters.Add("@miss", SqlDbType.Char) cmd.Parameters("@miss").Value = txtmissao cmd.Parameters.Add("@obj", SqlDbType.Char) cmd.Parameters("@obj").Value = txtobjectivo 'myCommand.Parameters.Add("@param", SqlDbType.Int) 'myCommand.Parameters("@param").Value = E.Item.Cells(1).Text cmd.ExecuteNonQuery() 'Response.Write(cmd.Parameters.Item(1).Value) Catch ex As Exception Response.Write(ex.ToString) Finally conn.Close() End Try DataGridUnidades.EditItemIndex = -1 If Not IsPostBack Then Else BinData() End If End Sub utilizo a seguinte stored procedure: ALTER procedure dbo.usp_UpdateUnidades @idunid int, @descr varchar(255), @tele int, @mail varchar(255), @miss varchar (255), @obj varchar(255) as update gaapi.Unidades set DESCRICAO_UNIDADE = @descr, TELEFONE_UNIDADE = @tele, EMAIL_UNIDADE = @mail, MISSAO_UNIDADE = @miss, OBJECTIVO_UNIDADE = @obj where ID_UNIDADE = @idunid poderiam ajudar-me se fazem favor?obrigado desde já a todos O ERRO DA NESTA LINHA cmd.ExecuteNonQuery()
  9. Obrigadao kuroi era mesmo isso é uma componente no asp.net fico agradecido mesmo para você sempre que precisar de ajuda e que eu possa resolver me contacte pode ate ser via MSN se desejar grande abraço
  10. não, não é assim o asp.net não tem essa componete, obrigado
  11. que eu pretendo é inserir dados numa area de texto estou usando o seguinte codigo: <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td align="left" width="150" bgColor="#c4d8ea" height="20">&nbsp;&nbsp;Dados da Unidade</td> </tr> <tr align="center"> <td bgColor="#ffffff" height="20"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="0"> <tr> <td align="right">&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td align="right" width="150" height="20"><asp:label id="LabelDescUnidade" runat="server">Nome:</asp:label></td> <td height="20"><asp:textbox id="TextBoxDescrUnidade" runat="server" Width="320px"></asp:textbox></td> </tr> <tr> <td style="HEIGHT: 24px" align="right" height="24"><asp:label id="LabelTelefoneUnidade" runat="server"> Telefone:</asp:label></td> <td style="HEIGHT: 24px" height="24"><asp:textbox id="TextBoxTelefoneUnidade" runat="server" Width="160px"></asp:textbox><asp:requiredfieldvalidator id="RFVTelefone" runat="server" ControlToValidate="TextBoxTelefoneUnidade" ErrorMessage="Informe o Telefone em Digitos">*</asp:requiredfieldvalidator></td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelEmailUnidade" runat="server">E-Mail:</asp:label></td> <td height="20"><asp:textbox id="TextBoxEMailUnidade" runat="server" Width="256px"></asp:textbox>&nbsp; </td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelMissaoUnidade" runat="server">Missão:</asp:label></td> <td height="20"><asp:textbox id="TextboxMissaoUnidade" runat="server" Width="272px"></asp:textbox>&nbsp; </td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelObjectivosUnidade" runat="server">Objectivos:</asp:label></td> <td height="20"><TEXTAREA id="TexAreaObj" rows="2" cols="20"> </TEXTAREA>&nbsp;</td> </tr> </table> <asp:validationsummary id="VSTelefone" runat="server"></asp:validationsummary></td> </tr> </table> <P><asp:button id="ButtonEnviarUnidade" runat="server" Text="Enviar"></asp:button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:button id="ButtonCancelar" runat="server" Text="Cancelar"></asp:button>&nbsp; </P> </td> </tr> como VB tenho o seguinte: Private Sub ButtonEnviarUnidade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEnviarUnidade.Click Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader sqlString = "usp_inserirUnidades" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add(New SqlParameter("@descr", TextBoxDescrUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@tele", TextBoxTelefoneUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@mail", TextBoxEMailUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@miss", TextboxMissaoUnidade.Text)) 'cmd.Parameters.Add(New SqlParameter("@obj", TextBoxTesteObj.Text)) cmd.Parameters.Add(New SqlParameter("@miss", TexAreaObj.Text)) dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) TextBoxTelefoneUnidade.Text() = "" TextBoxEMailUnidade.Text() = "" TextboxMissaoUnidade.Text() = "" ' TextBoxTesteObj.Text() = "" 'dgInscritos.DataSource = dr 'dgInscritos.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try End Sub mas da um erro a dizer que TexAreaObj não esta declarada alguém me pode dar uma ajuda?
  12. hpires24

    Vb.net7sqlserver

    Problema solucionado segue abaixo as alteraçoes para quem um dia tiver a mesma duvida se eu puder também esclarecer alguma coisa sempre o farei a quem necessite. Private Sub ButtonEnviarUnidade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEnviarUnidade.Click Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader sqlString = "usp_inserirUnidades" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add(New SqlParameter("@descr", TextBoxDescrUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@tele", TextBoxTelefoneUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@mail", TextBoxEMailUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@miss", TextboxMissaoUnidade.Text)) cmd.Parameters.Add(New SqlParameter("@obj", TextBoxTesteObj.Text)) dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) 'dgInscritos.DataSource = dr 'dgInscritos.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try End Sub
  13. Ola bom dia a todos gostaria que me pudesem ajudar se fosse possivel vou tentar esclarecer a minha duvida. É assim tenho um formulario de inserção de dados que é o seguinte: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="unidades.aspx.vb" Inherits="gaapi.unidades"%> <%@ Register TagPrefix="uc1" TagName="topo" Src="topo.ascx" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>proj</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <uc1:topo id="Topo1" runat="server" DESIGNTIMEDRAGDROP="94"></uc1:topo> <table height="500" cellSpacing="1" cellPadding="0" width="100%" align="center" border="0"> <tr vAlign="top"> <td> <table height="300" cellSpacing="1" cellPadding="0" width="100%" align="center" border="1"> <tr> <td vAlign="top" align="center" bgColor="#ffffff"><br> <span class="verdana10"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td bgColor="#f9e3a2" height="20">Nova Unidade</td> </tr> </table> <br> </span> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td align="left" width="150" bgColor="#c4d8ea" height="20"> Dados da Unidade</td> </tr> <tr align="center"> <td bgColor="#ffffff" height="20"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="0"> <tr> <td align="right"> </td> <td> </td> </tr> <tr> <td align="right" width="150" height="20"><asp:label id="LabelDescUnidade" runat="server">Nome:</asp:label></td> <td height="20"><asp:textbox id="TextBoxDescrUnidade" runat="server" Width="320px"></asp:textbox></td> </tr> <tr> <td style="HEIGHT: 24px" align="right" height="24"><asp:label id="LabelTelefoneUnidade" runat="server"> Telefone:</asp:label></td> <td style="HEIGHT: 24px" height="24"><asp:textbox id="TextBoxTelefoneUnidade" runat="server" Width="160px"></asp:textbox><asp:requiredfieldvalidator id="RFVTelefone" runat="server" ControlToValidate="TextBoxTelefoneUnidade" ErrorMessage="Informe o Telefone em Digitos">*</asp:requiredfieldvalidator></td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelEmailUnidade" runat="server">E-Mail:</asp:label></td> <td height="20"><asp:textbox id="TextBoxEMailUnidade" runat="server" Width="256px"></asp:textbox> </td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelMissaoUnidade" runat="server">Missão:</asp:label></td> <td height="20"><asp:textbox id="TextboxMissaoUnidade" runat="server" Width="272px"></asp:textbox> </td> </tr> <tr> <td align="right" height="20"><asp:label id="LabelObjectivosUnidade" runat="server">Objectivos:</asp:label></td> <td height="20"><TEXTAREA style="WIDTH: 280px; HEIGHT: 72px" rows="4" cols="32"> </TEXTAREA> </td> </tr> </table> <asp:validationsummary id="VSTelefone" runat="server"></asp:validationsummary></td> </tr> </table> <P><asp:button id="ButtonEnviarUnidade" runat="server" Text="Enviar"></asp:button> <asp:button id="ButtonCancelar" runat="server" Text="Cancelar"></asp:button> </P> </td> </tr> <tr align="center"> <td> <P> </P> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td bgColor="#f9e3a2" height="20">Actualizar Unidades(DataGrid)</td> </tr> </table> <br> </SPAN> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="1"> <tr align="center"> <td align="left" width="150" bgColor="#c4d8ea" height="20"> Dados da Unidade</td> </tr> <tr align="center"> <td bgColor="#ffffff" height="20"> <table class="verdana10" cellSpacing="1" cellPadding="0" width="550" border="0"> <tr> <td align="right"> </td> <td> </td> </tr> <tr> <td align="right" width="150" height="20"><asp:label id="Label2" runat="server">Titulo Projecto:</asp:label></td> <td height="20"><asp:textbox id="Textbox3" runat="server" Width="320px"></asp:textbox></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </form> </body> </HTML> e qd preencho o formulario e clico no botao enviar para enviar para a base de daos faço o seguinte: Private Sub ButtonEnviarUnidade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEnviarUnidade.Click Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("connstring")) Dim sqlString As String Dim cmd As SqlCommand Dim dr As SqlDataReader sqlString = "usp_inserirUnidades" 'Response.Write(sqlString) Try conn.Open() cmd = New SqlCommand(sqlString, conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("@TELEFONE_UNIDADE", SqlDbType.Int) cmd.Parameters("@DESCRICAO_UNIDADE").Value = TextBoxDescrUnidade cmd.Parameters("@TELEFONE_UNIDADE").Value = TextBoxTelefoneUnidade cmd.Parameters("@EMAIL_UNIDADE").Value = TextBoxEMailUnidade cmd.Parameters("@MISSAO_UNIDADE").Value = TextboxMissaoUnidade dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) 'dgInscritos.DataSource = dr 'dgInscritos.DataBind() Catch ex As Exception 'Response.Redirect("../perfil/errordb.aspx") Response.Write(ex.ToString) Finally If Not dr Is Nothing Then dr.Close() End If End Try End Sub so que me surge um erro que é o seguinte : System.IndexOutOfRangeException: An SqlParameter with ParameterName '@DESCRICAO_UNIDADE' is not contained by this SqlParameterCollection. at System.Data.SqlClient.SqlParameterCollection.RangeCheck(String parameterName) at System.Data.SqlClient.SqlParameterCollection.get_Item(String parameterName) at gaapi.unidades.ButtonEnviarUnidade_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\gaapi\unidades.aspx.vb:line 67 a stored procedure que eu uso para inseriir tem o seguinte codigo: ALTER procedure dbo.usp_inserirUnidades @descr varchar(255), @tele int, @mail varchar(255), @miss varchar (255), @obj varchar(255) as insert into gaapi.UNIDADES (DESCRICAO_UNIDADE, TELEFONE_UNIDADE, EMAIL_UNIDADE, MISSAO_UNIDADE, OBJECTIVO_UNIDADE) values (@descr, @tele, @mail, @miss, @obj) o que há de errado alguém em pode ajudar?
  14. hpires24

    Sql

    Bom dia estou a utilizar o seguinte codigo SQL Function sql_reencaminharpara() dim sql sql = "SELECT * " & _ "FROM tbl_assuntoshelpdesk A " & _ " inner join tbl_empregados B on A.id_assuntoshelpdesk = B.id_assuntoshelpdesk " & _ "WHERE A.id_assuntoshelpdeskk = " & session("id_assuntoshelpdesk") & "" sql_reencaminharpara = sql End Function que depois é chamdo nesta pagina asp: <%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: pedidoshelpedesk/processa-criar.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <% for each i in Request.Form session(i) = SQLEncode(Request.Form(i)) next If session("id_assuntoshelpdesk") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_assunto") End If if session("gravidade") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_gravidade") end if if session("descricao_pedidohelpdesk") = "" then session("descricao_pedidohelpdesk") = NULL end if If Session("strErrorMessage") <> "" then response.redirect "criarpedido.asp" End If sql = sql_empregadospedidos(employee_id) Call RunSQL(sql, rs) if not rs.eof then mail= rs("Email") End If sql = sql_InserirPedido( _ session("employee_id"), _ session("id_assuntoshelpdesk"), _ session("gravidade"), _ date(), _ session("estado_pedidohelpdesk"), _ mail, _ session("descricao_pedidohelpdesk")) Call DoSQL(sql) %> <!--#include file="../includes/main_page_open.asp"--> <% for each i in request.form session(i) = "" next %> <% ' Envio de mensagem de email DIM strName, strEmail, strReason, strComments, Mailer sql = sql_reencaminharpara() Call RunSQL(sql, rs) if not rs.eof then strEmail= rs("Email") End If Const cdoSendUsingPickup = 1 Const cdoSendUsingPort = 2 Const cdoAnonymous = 0 Const cdoBasic = 1 Const cdoNTLM = 2 Set Mailer = CreateObject("CDO.Message") Mailer.Subject ="HELP-DESK" Mailer.From = "acarlos@cm-braganca.pt" 'Quem envia Mailer.To = strEmail 'Quem recebe rs("USERName") & "@MyCompany.com" Mailer.TextBody = "Assunto: " & "assunto" & vbCrLf & _ "Gravidade: " & "gravidade" & vbCrLf & _ "Descrição: " & "descrição" Mailer.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Enter the domain SMTP address for your address" Mailer.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.cm-braganca.pt" Mailer.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 Mailer.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False Mailer.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 Mailer.Configuration.Fields.Update Mailer.Send Set Mailer = Nothing %> <%response.redirect "default.asp"%><!--#include file="../includes/main_page_close.asp"--> so que me da sempre o mesmo erro de sql o erro q da é o seguinte : Error Occured: Error # -2147217900 Syntax error (missing operator) in query expression 'A.id_assuntoshelpdeskk ='. SQL = SELECT * FROM tbl_assuntoshelpdesk A inner join tbl_empregados B on A.id_assuntoshelpdesk = B.id_assuntoshelpdesk WHERE A.id_assuntoshelpdeskk = não estou conseguindo resolver alguém me poderia ajudar??? desde já um obrigado a todos
  15. hpires24

    Ordenação

    É isso mesmo falatavam as 'Pendente' esta tudo correcto agora obrigado pela ajuda qualqer duvida q possa esclarecer eu tentarei ajudar obrigadao a todos. Tópico Fechado
  16. hpires24

    Ordenação

    olhe obrigado pela ajuda mas gera o mesmo erro, olhe mais uma dica para ver se você me ajuda "Pendente " é um valor q vem da base de dados será q a igualdade não é assim q se efectua????
  17. hpires24

    Ordenação

    Boas tardes estou com o seguinte problema tenho uma consulta a uma bd Acess e essa consulta esta a funcionar correctamente so q eu queria q os dados ficassem ordenados por data e depois por estado, ou seja os q tiverem estado igual a pendente estou usando o codigo seguinte: Function sql_GetAllpedidos() dim sql sql = "SELECT * " & _ "FROM tbl_pedidohelpdesk A, tbl_assuntoshelpdesk B, tbl_gravPedHelpdesk C, tbl_empregados D " & _ "WHERE A.id_assuntoshelpdesk=B.id_assuntoshelpdesk And A.gravidade=C.id_gravpedhelpdesk and A.id_empregado = D.id_empregado " & _ "ORDER BY A.data_pedido_helpdesk DESC and A.estado_pedidohelpdesk = Pendente" sql_GetAllpedidos = sql End Function so que da o seguinte erro Error # -2147217900 Erro de sintaxe na cláusula ORDER BY. SQL = SELECT * FROM tbl_pedidohelpdesk A, tbl_assuntoshelpdesk B, tbl_gravPedHelpdesk C, tbl_empregados D WHERE A.id_assuntoshelpdesk=B.id_assuntoshelpdesk And A.gravidade=C.id_gravpedhelpdesk and A.id_empregado = D.id_empregado ORDER BY A.data_pedido_helpdesk DESC and A.estado_pedidohelpdesk = Pendente alguém me poderia ajudar a solucionar este problema???
  18. hpires24

    Erro Sintaxe

    Oi bom dia estou executando a query seguinte sobre uma base de dados Acess e estou a utilizar ASP. Function sql_PedidosAtribuidos5() dim sql sql = "select * " & _ "from (tbl_assuntoshelpdesk AS A inner join tbl_pedidohelpdesk AS B on A.id_assuntoshelpdesk = B.id_assuntoshelpdesk )" & _ " inner join tbl_gravPedHelpdesk AS C ON B.gravidade = C.id_gravpedhelpdesk " & _ " inner join tbl_empregados AS D ON B.id_empregado = D.id_empregado " & _ "where A.id_empregado = " & session("employee_id") & "" sql_PedidosAtribuidos5 = sql End Function e da-me o seguinte erro: Error Occured: Error # -2147217900 Erro de sintaxe (operador em falta) na expressão de consulta 'B.gravidade = C.id_gravpedhelpdesk inner join tbl_empregados AS D ON B.id_empregado = D.id_empregado'. SQL = select * from (tbl_assuntoshelpdesk AS A inner join tbl_pedidohelpdesk AS B on A.id_assuntoshelpdesk = B.id_assuntoshelpdesk ) inner join tbl_gravPedHelpdesk AS C ON B.gravidade = C.id_gravpedhelpdesk inner join tbl_empregados AS D ON B.id_empregado = D.id_empregado where A.id_empregado = 136 alguém me poderia ajudar a resolver este erro. Obrigado a todos
  19. hpires24

    Acess-mysql

    alguém me poderia dizer como eu posso passar minha aplicação de acess para mysql estou usando ASP
  20. hpires24

    Converter Maiusculas

    Obrigado mas não esta a resultar eu vou postar o codigo depois vejam se poderem é assim eu esotu a inserir dados num formulário e eu quero q ao visualizar esses dados eles estejam em letras maiusculas independentemente de elas ao serem inseridos "os dados" sejam em maisuculas ou minusculas <tr> <td><b class="bolddark"><%=dictLanguage("nome_servico")%>:</b><font class="alert">*</font></td> <td><input name="Servicos_descricao" size="20" value='<%=UCase(Session("Servicos_descricao"))%>' class="formStyleLong" maxlength="100" ></td> </tr> obrigado a todos
  21. hpires24

    Converter Maiusculas

    Oi pessoal gostaria de saber como posso converter uma string para maiusculas em ASP
  22. hpires24

    Global.asa

    Boa tarde gostaria de saber se atraves do global.asa eu consigo determinar permissoes para acesso a uma aplicação, casa me saibam esclarecer a duvida como tenho de o fazer sei q o global.asa compreende 4 etapas mas não sei como fazer essas etapas eu estou usando esse codigo abaixo mas não funciona. Atenciosamente grato a todos. <script LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart Application.Lock Application("permAll") = 1 Application("permAdminAll") = 1 Application("permAdmin") = 1 Application("permAdminDatabaseSetup") = 1 Application("permFuncionariosAdd") = 1 Application("permFuncionariosEdit") = 1 Application("permFuncionariosDelete") = 1 Application.UnLock End Sub Sub Session_OnStart Application.Lock Session("permAll") = 1 Session("permAdminAll") = 1 Session("permAdmin") = 1 Session("permAdminDatabaseSetup") = 1 Session("permFuncionariosAdd") = 1 Session("permFuncionariosEdit") = 1 Session("permFuncionariosDelete") = 1 Application.UnLock End Sub Sub Session_OnEnd Application.Lock Session("permAll") = 0 Session("permAdminAll") = 0 Session("permAdmin") = 0 Session("permAdminDatabaseSetup") = 0 Session("permFuncionariosAdd") = 0 Session("permFuncionariosEdit") = 0 Session("permFuncionariosDelete") = 0 Application.UnLock end sub Sub Application_OnEnd End Sub </SCRIPT> terei q chamar o global.asa em alguma página???
  23. Vou postar meu código. Ajuda, Obrigado. <%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: fornecedores/ver-fornecedores.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <!-- #include file="../includes/style.asp"--> <!-- #include file="../includes/main_page_open.asp"--> <% sql = sql_GetActiveNoticias() Call RunSQL(sql, rs) %> <table width="100%" border=0 cellpadding=1 cellspacing=1> <% Dim pageNo, i, limit pageNo = CInt(Request.QueryString("pNum")) If pageNo = 0 Then pageNo = 1 End If rs.PageSize = 1 rs.Move (pageNo - 1) * rs.PageSize ' Work out how many records are in this page If rs.AbsolutePage < rs.PageCount Then limit = rs.PageSize Else limit = rs.RecordCount - rs.PageCount * rs.PageSize + rs.PageSize End If '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %> <tr> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Nome_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Data_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("URL_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Conteudo_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Noticia_activa")%></td> <td valign="top" width="1%" class="columnheader" bgcolor="<%=gsColorHighlight%>"><img src="<%=gsSiteRoot%>images/document.gif" WIDTH="11" HEIGHT="14"></td> </tr> <% For i = 1 To limit strEmpID = rs("id_noticias") strNome = trim(rs("nome_noticia")) strData = trim(rs("data_noticia")) strUrl = trim(rs("url_noticia")) strConteudo = trim(rs("conteudo_noticia")) strActivo = trim(rs("noticia_activa")) if isNull(strNome) then strNome = "&nbsp;" else strNome = "<a href=""default.asp?ID_pensa=" & strEmpID & """ class=""small"">" & strNome & "</a>" end if if isNull(strData) then strData = "&nbsp;" end if if isNull(strUrl) then strUrl = "&nbsp;" end if if isNull(strConteudo) then strConteudo = "&nbsp;" end if if isNull(strActivo) then strActivo = "&nbsp;" end if %> <tr <%If intRowcounter MOD 2 = 1 then %>bgcolor="<%=gsColorWhite%>"<%Else%>bgcolor="#ffFF77"<%End If%>> <td valign=top class="small"><a href="editarnoticia.asp?id_noticias=<%=rs("id_noticias")%>"><%=rs("nome_noticia")%></a></td> <td valign=top class="small"><%=rs("data_noticia")%></td> <td valign=top class="small"><%=rs("url_noticia")%></td> <td valign=top class="small"><%=rs("conteudo_noticia")%></td> <td valign=top class="small"><%=rs("noticia_activa")%></td> <td valign="top" class="small"> <% if (session("permFuncionariosDelete") or session("id_noticias")=rs("nome_noticia")) then %> <a href="eliminarnoticia.asp?id=<%=rs("id_noticias")%>" onClick="javascript: return confirm('<%=dictLanguage("Confirm_Task_Delete")%>');"><img src="<%=gsSiteRoot%>images/delete.gif" WIDTH="20" HEIGHT="19" border="0" alt="<%=dictLanguage("Eliminar")%>"></a> <% end if %> </td> </tr> <tr align="right"> <td align="right" colspan="7"> <p>&nbsp; </p> <% rs.movenext next '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Paginação de registos - parte 2 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Response.Write "<p><a href=""ver_todos_paginacaoN.asp?pNum=1"">Início</a> " If pageNo > 1 Then Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & pageNo - 1 & """>Anterior</a> " End If If pageNo < rs.PageCount Then Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & pageNo + 1 & """>Seguinte</a> " End If Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & rs.PageCount & """>Fim</a><br>" For i = 1 To rs.Pagecount If i <> pageNo Then Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & i & """>" & i & "</a> | " Else Response.Write i & " | " End If Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' rs.close set rs = nothing %> </td> </tr> </table> <!-- #include file="../includes/main_page_close.asp"--> e nesse codigo acima se por exemplo quando selecciono o nome da noticia permite-me editar a mesma abrindo uma "tela" formulário Noticias onde existem esses campos: Nome_noticia data...... url...... conteudo...... que são campos de preenchimento obrigatórios e ao editarmos esses campos não podem ficar a vazios. O q me esta a contecer é q eu por exemplo apago os dados q estao a frente do nome noticia no formulário e ai devolvo uma mensagem de erra a dizer q falta nome isto ate aqui esta certo. mas o q eu keria era ao apagar me devolvesse essa mensagem mas tambem q coloca-se em branco o q esta a frente do nome e o q esta a fazer no momento é devolver a mensagem de erro mas depois continua a deixar ficar no formlario os dados q eu tentei deletar. Abaixo segue o codigo de editar q eu estou usando e em cima é o codigo para ver as noticias obrigado a todos desde já abraço. <%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: recursos/editar.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <% id_noticias = request.querystring("id_noticias") sql = sql_GetNoticiasByID(id_noticias) Call RunSQL(sql, rs) if not rs.eof then boolFound = TRUE strNome = trim(rs("nome_noticia")) strData = trim(rs("data_noticia")) strUrl = trim(rs("url_noticia")) strConteudo = trim(rs("conteudo_noticia")) strActivo = trim(rs("noticia_activa")) else boolFound = FALSE end if rs.close set rs = nothing %> <!-- #include file="../includes/main_page_open.asp"--> <% if boolFound then %> <% if strActivo = -1 or strActivo then strActivo = TRUE else strActivo = false end if if strFoto <> "" then strFoto = "<img src=""" & gsSiteRoot & "empregados/images/" & strFoto & """>" else strFoto = "<img src=""" & gsSiteRoot & "empregados/images/imageNA.gif"">" end if %> <table cellpadding="2" cellspacing="0" align="center" width="450"> <tr><td </td>&nbsp;</tr> <tr><td colspan="2" bgcolor="<%=gsColorHighlight%>" class="tblheader" align="center"><%=dictLanguage("noticias")%></td></tr> </table> <form method="post" action="processa_editarnoticia.asp" name="strForm1" value="strForm1"> <input type="hidden" name="id_noticias" value="<%=id_noticias%>"> <table class="tblborder2px" cellpadding="1" cellspacing="1" align="center" width="450"> <tr> <td><b class="bolddark"><%=dictLanguage("Nome_noticia")%>:</b><font class="alert">*</font></td> <td><input name="nome_noticia" size="20" value="<%=strNome%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("Data_noticia")%>:</b><font class="alert">*</font></td> <td><input name="data_noticia" size="20" value="<%=strData%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("URL_noticia")%>:</b><font class="alert">*</font></td> <td><input name="url_noticia" size="20" value="<%=strUrl%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("Conteudo_noticia")%>:</b><font class="alert">*</font></font></td> <td><input name="conteudo_noticia" size="20" value="<%=strConteudo%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("Noticia_activa")%>:</b></td> <td> <select name="strActivo" size="1" class="formStyleShort"> <option value=False>Não</option> <option value=True <%if strActivo then Response.Write "Selected"%>>Sim</option> </select> </td> </tr> </table> <%if session("permFuncionariosEdit") then %> <p align="center"> <input type="submit" name="Submit" value="Gravar alterações" class="formButton"> </p> <%end if%> </form> <% else %> <div align="center"><%=dictLanguage("No_Fornecedor_ID")%>.</div> <% end if %><!-- #include file="../includes/main_page_close.asp"--> <%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: Recursos/processa_editar.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <% for each i in Request.Form session(i) = SQLEncode(Request.Form(i)) next If session("nome_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_Nome_noticia") End If If session("conteudo_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_contudo_noticia") End If if session("data_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_contudo_Data") end if If session("url_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_URL") End If If Session("strErrorMessage") <> "" then response.redirect "editarnoticia.asp?id_noticias=" & session("id_noticias") & "" End If if session("strActivo") = "True" then strActivo = 1 else strActivo = 0 end if sql = sql_UpdateNoticias( _ session("id_noticias"), _ session("nome_noticia"), _ session("data_noticia"), _ session("url_noticia"), _ session("conteudo_noticia"), _ strActivo) Call DoSQL(sql) %> <!--#include file="../includes/main_page_open.asp"--> <% for each i in Request.Form session(i) = "" next %> <%response.redirect "default.asp"%> <!--#include file="../includes/main_page_close.asp"--> Ajuda e muito obrigado desde já a todos
  24. Precisava de uma ajudinha, eu tenho um formulario de preenchimento obrigatório, e caso esse formulario não seja preenchido ou mal preenchido da-me uma mensagem de erro o q eu pretendo é quando me da essa mensgem de erro eu limpe esse campo do formulário ou seja coloca-lo em branco. se precisarem eu posto aqui o meu codigo
  25. hpires24

    Editar

    Em primeiro obrigado a vocês, então vou tentar esclarecer melhor minha duvida. É assim eu tenho uma pagina para ver noticias, seguinte: <%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: fornecedores/ver-fornecedores.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <!-- #include file="../includes/style.asp"--> <!-- #include file="../includes/main_page_open.asp"--> <% sql = sql_GetActiveNoticias() Call RunSQL(sql, rs) %> <table width="100%" border=0 cellpadding=1 cellspacing=1> <% Dim pageNo, i, limit pageNo = CInt(Request.QueryString("pNum")) If pageNo = 0 Then pageNo = 1 End If rs.PageSize = 1 rs.Move (pageNo - 1) * rs.PageSize ' Work out how many records are in this page If rs.AbsolutePage < rs.PageCount Then limit = rs.PageSize Else limit = rs.RecordCount - rs.PageCount * rs.PageSize + rs.PageSize End If '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %> <tr> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Nome_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Data_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("URL_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Conteudo_noticia")%></td> <td valign="top" class="columnheader" bgcolor="<%=gsColorHighlight%>"><%=dictLanguage("Noticia_activa")%></td> <td valign="top" width="1%" class="columnheader" bgcolor="<%=gsColorHighlight%>"><img src="<%=gsSiteRoot%>images/document.gif" WIDTH="11" HEIGHT="14"></td> </tr> <% For i = 1 To limit strEmpID = rs("id_noticias") strNome = trim(rs("nome_noticia")) strData = trim(rs("data_noticia")) strUrl = trim(rs("url_noticia")) strConteudo = trim(rs("conteudo_noticia")) strActivo = trim(rs("noticia_activa")) if isNull(strNome) then strNome = "&nbsp;" else strNome = "<a href=""default.asp?ID_pensa=" & strEmpID & """ class=""small"">" & strNome & "</a>" end if if isNull(strData) then strData = "&nbsp;" end if if isNull(strUrl) then strUrl = "&nbsp;" end if if isNull(strConteudo) then strConteudo = "&nbsp;" end if if isNull(strActivo) then strActivo = "&nbsp;" end if %> <tr <%If intRowcounter MOD 2 = 1 then %>bgcolor="<%=gsColorWhite%>"<%Else%>bgcolor="#ffFF77"<%End If%>> <td valign=top class="small"><a href="editarnoticia.asp?id_noticias=<%=rs("id_noticias")%>"><%=rs("nome_noticia")%></a></td> <td valign=top class="small"><%=rs("data_noticia")%></td> <td valign=top class="small"><%=rs("url_noticia")%></td> <td valign=top class="small"><%=rs("conteudo_noticia")%></td> <td valign=top class="small"><%=rs("noticia_activa")%></td> <td valign="top" class="small"> <% if (session("permFuncionariosDelete") or session("id_noticias")=rs("nome_noticia")) then %> <a href="eliminarnoticia.asp?id=<%=rs("id_noticias")%>" onClick="javascript: return confirm('<%=dictLanguage("Confirm_Task_Delete")%>');"><img src="<%=gsSiteRoot%>images/delete.gif" WIDTH="20" HEIGHT="19" border="0" alt="<%=dictLanguage("Eliminar")%>"></a> <% end if %> </td> </tr> <tr align="right"> <td align="right" colspan="7"> <p>&nbsp; </p> <% rs.movenext next '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Paginação de registos - parte 2 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Response.Write "<p><a href=""ver_todos_paginacaoN.asp?pNum=1"">Início</a> " If pageNo > 1 Then Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & pageNo - 1 & """>Anterior</a> " End If If pageNo < rs.PageCount Then Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & pageNo + 1 & """>Seguinte</a> " End If Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & rs.PageCount & """>Fim</a><br>" For i = 1 To rs.Pagecount If i <> pageNo Then Response.Write "<a href=""ver_todos_paginacaoN.asp?pNum=" & i & """>" & i & "</a> | " Else Response.Write i & " | " End If Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' rs.close set rs = nothing %> </td> </tr> </table> <!-- #include file="../includes/main_page_close.asp"--> e nesse codigo acima se por exemplo quando selecciono o nome da noticia permite-me editar a mesma abrindo uma "tela" formulário Noticias onde existem esses campos: Nome_noticia data...... url...... conteudo...... que são campos de preenchimento obrigatórios e ao editarmos esses campos não podem ficar a vazios. O q me esta a contecer é q eu por exemplo apago os dados q estao a frente do nome noticia no formulário e ai devolvo uma mensagem de erra a dizer q falta nome isto ate aqui esta certo. mas o q eu keria era ao apagar me devolvesse essa mensagem mas tambem q coloca-se em branco o q esta a frente do nome e o q esta a fazer no momento é devolver a mensagem de erro mas depois continua a deixar ficar no formlario os dados q eu tentei deletar. Abaixo segue o codigo de editar q eu estou usando e em cima é o codigo para ver as noticias obrigado a todos desde já abraço.<%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: recursos/editar.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <% id_noticias = request.querystring("id_noticias") sql = sql_GetNoticiasByID(id_noticias) Call RunSQL(sql, rs) if not rs.eof then boolFound = TRUE strNome = trim(rs("nome_noticia")) strData = trim(rs("data_noticia")) strUrl = trim(rs("url_noticia")) strConteudo = trim(rs("conteudo_noticia")) strActivo = trim(rs("noticia_activa")) else boolFound = FALSE end if rs.close set rs = nothing %> <!-- #include file="../includes/main_page_open.asp"--> <% if boolFound then %> <% if strActivo = -1 or strActivo then strActivo = TRUE else strActivo = false end if if strFoto <> "" then strFoto = "<img src=""" & gsSiteRoot & "empregados/images/" & strFoto & """>" else strFoto = "<img src=""" & gsSiteRoot & "empregados/images/imageNA.gif"">" end if %> <table cellpadding="2" cellspacing="0" align="center" width="450"> <tr><td </td>&nbsp;</tr> <tr><td colspan="2" bgcolor="<%=gsColorHighlight%>" class="tblheader" align="center"><%=dictLanguage("noticias")%></td></tr> </table> <form method="post" action="processa_editarnoticia.asp" name="strForm1" value="strForm1"> <input type="hidden" name="id_noticias" value="<%=id_noticias%>"> <table class="tblborder2px" cellpadding="1" cellspacing="1" align="center" width="450"> <tr> <td><b class="bolddark"><%=dictLanguage("Nome_noticia")%>:</b><font class="alert">*</font></td> <td><input name="nome_noticia" size="20" value="<%=strNome%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("Data_noticia")%>:</b><font class="alert">*</font></td> <td><input name="data_noticia" size="20" value="<%=strData%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("URL_noticia")%>:</b><font class="alert">*</font></td> <td><input name="url_noticia" size="20" value="<%=strUrl%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("Conteudo_noticia")%>:</b><font class="alert">*</font></font></td> <td><input name="conteudo_noticia" size="20" value="<%=strConteudo%>" class="formStyleLong" maxlength="100"></td> </tr> <tr> <td><b class="bolddark"><%=dictLanguage("Noticia_activa")%>:</b></td> <td> <select name="strActivo" size="1" class="formStyleShort"> <option value=False>Não</option> <option value=True <%if strActivo then Response.Write "Selected"%>>Sim</option> </select> </td> </tr> </table> <%if session("permFuncionariosEdit") then %> <p align="center"> <input type="submit" name="Submit" value="Gravar alterações" class="formButton"> </p> <%end if%> </form> <% else %> <div align="center"><%=dictLanguage("No_Fornecedor_ID")%>.</div> <% end if %><!-- #include file="../includes/main_page_close.asp"--> <%@ LANGUAGE="VBSCRIPT" %> <%'******************************************************************************************* ' ' ficheiro: Recursos/processa_editar.asp ' '********************************************************************************************%> <!--#include file="../includes/main_page_header.asp"--> <% for each i in Request.Form session(i) = SQLEncode(Request.Form(i)) next If session("nome_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_Nome_noticia") End If If session("conteudo_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_contudo_noticia") End If if session("data_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_contudo_Data") end if If session("url_noticia") = "" then Session("strErrorMessage") = Session("strErrorMessage") & "<br>" & dictLanguage("Erro_sem_URL") End If If Session("strErrorMessage") <> "" then response.redirect "editarnoticia.asp?id_noticias=" & session("id_noticias") & "" End If if session("strActivo") = "True" then strActivo = 1 else strActivo = 0 end if sql = sql_UpdateNoticias( _ session("id_noticias"), _ session("nome_noticia"), _ session("data_noticia"), _ session("url_noticia"), _ session("conteudo_noticia"), _ strActivo) Call DoSQL(sql) %> <!--#include file="../includes/main_page_open.asp"--> <% for each i in Request.Form session(i) = "" next %> <%response.redirect "default.asp"%> <!--#include file="../includes/main_page_close.asp"--> Espero ter exposto melhor a minha duvida agradecia ajuda obrigado
×
×
  • Criar Novo...