Ir para conteúdo
Fórum Script Brasil
  • 0

Formulario Com Uma Listbox


hpires24

Pergunta

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

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0
Será qnao é detste modo que eu passo os dados que estao carregados na listbox:

cmd.Parameters.Add(New SqlParameter("@projetos", ListboxProjectos))???

Acredito que não. Você teria que fazer um loop percorrendo os itens da ListBox. Mas, qual é o tipo do campo "projetos"? Se for texto, acho que você poderia fazer algo assim:

dim s as string = ""

for each elemento as ListItem in ListboxProjectos.Items
    s &= elemento.Text
next elemento

cmd.Parameters.Add(New SqlParameter("@projetos", s))

Certo? ;)

Graymalkin

Link para o comentário
Compartilhar em outros sites

  • 0

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))

Link para o comentário
Compartilhar em outros sites

  • 0

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á

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...