Jump to content
Sign in to follow this  
bluejoao

DataSource e DataSourceID estão definidos em 'GridView1'. Retire uma definição.

Recommended Posts

bluejoao

ola

tou a criar parametros e depois de ter tudo criado ele dá-me este erro... nao sei o k fazer.. :S

Erro: "DataSource e DataSourceID estão definidos em 'GridView1'.  Retire uma definição."

Stored Procedure:

ALTER PROCEDURE dbo.StoredProcedure1

(

@id_carro int

)

AS

select * from Carros where id_carro like ( @id_carro)

RETURN

Código Parametros:

Dim comm As New SqlCommand

        comm.Connection = conn

        comm.CommandText = "StoredProcedure1"

        comm.CommandType = CommandType.StoredProcedure

        Dim p As New SqlParameter("@id_carro", SqlDbType.Int)

        p.Value = TextBox2.Text

        p.Direction = ParameterDirection.Input

        comm.Parameters.Add(p)

        Dim dt As New DataTable

        Dim da As New SqlDataAdapter

        da.SelectCommand = comm

        da.Fill(dt)

        GridView1.DataSource = dt

        Page.DataBind()

Ajudem-me por favor!

Obrigadooo!

Share this post


Link to post
Share on other sites
bluejoao

Já ta resolvido =D

o problema era que estava a redireccionar os resultados da pesquisa para uma gridview ja com parametros predefinidos era so preciso por uma nova!

obrigado na mesma!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.