Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello

I want to begin a SQL connection with a SQL database in VB.NET(ASP.NET). I used the syntax

<%@ Import namespace="System.Data.Sqlclient" %>

but VB makes an error from the first "%" sign. I wrote the syntax in Button1_Click event. what is the problem. I will be very happy if you can help me

Thank you very much.

Posted

ASP.Net directives

 

<%@ ... %> directives must be placed at the top of the .aspx page, not within other code. However, if you are using codebehind - if your Button1_Click event is within a file with extension .aspx.vb - then you do not need this directive. You can simply place Import System.Data.SqlClient at the top of your VB code.

 

Good luck :cool:

Never trouble another for what you can do for yourself.

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.   Paste as plain text instead

  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.

×
×
  • Create New...