472,784 Members | 1,101 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

Name 'SqlDbType' is not declared?

Hi,

I keep getting the same compiler error: 'Name 'SqlDbType' is not
declared' and I don't know why?

I've declared the following:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ import Namespace="System.Data." %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ import Namespace="System.Data.SqlDbType" %>

What am I missing?

Any help would be greatly appreciated!

Jerome
Nov 18 '05 #1
9 6225
Jerome,

There is no namespace System.Data.SqlDbType.

System.Data.SqlClient.SqlDbType is an enum and you can't use it with the
Import keyword.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#k**************@TK2MSFTNGP09.phx.gbl...
Hi,

I keep getting the same compiler error: 'Name 'SqlDbType' is not
declared' and I don't know why?

I've declared the following:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ import Namespace="System.Data." %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ import Namespace="System.Data.SqlDbType" %>

What am I missing?

Any help would be greatly appreciated!

Jerome


Nov 18 '05 #2
Thanks Martin, but what could the reason be for that error message then?
Because even when removing the import keyword, it keeps getting displayed.

How do I declare that SqlDbType?

Thanks.
Martin Dechev wrote:
Jerome,

There is no namespace System.Data.SqlDbType.

System.Data.SqlClient.SqlDbType is an enum and you can't use it with the
Import keyword.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#k**************@TK2MSFTNGP09.phx.gbl...
Hi,

I keep getting the same compiler error: 'Name 'SqlDbType' is not
declared' and I don't know why?

I've declared the following:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ import Namespace="System.Data." %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ import Namespace="System.Data.SqlDbType" %>

What am I missing?

Any help would be greatly appreciated!

Jerome


Nov 18 '05 #3
Here's the line where the error comes:

cmdInsert.Parameters.Add( "@datedebut", SqlDbType.SmallDateTime
).Value=datedebut.Text )

Perhaps that'll help?

Jerome wrote:
Thanks Martin, but what could the reason be for that error message then?
Because even when removing the import keyword, it keeps getting displayed.

How do I declare that SqlDbType?

Thanks.
Martin Dechev wrote:
Jerome,

There is no namespace System.Data.SqlDbType.

System.Data.SqlClient.SqlDbType is an enum and you can't use it with the
Import keyword.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#k**************@TK2MSFTNGP09.phx.gbl...
Hi,

I keep getting the same compiler error: 'Name 'SqlDbType' is not
declared' and I don't know why?

I've declared the following:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ import Namespace="System.Data." %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ import Namespace="System.Data.SqlDbType" %>

What am I missing?

Any help would be greatly appreciated!

Jerome


Nov 18 '05 #4
You don't need to declare it, just use it:

Dim dbInt As SqlDbType = _
SqlDbType.Int

Have a look at:

http://msdn.microsoft.com/library/en...umerations.asp

Greetings
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
Thanks Martin, but what could the reason be for that error message then?
Because even when removing the import keyword, it keeps getting displayed.

How do I declare that SqlDbType?

Thanks.
Martin Dechev wrote:
Jerome,

There is no namespace System.Data.SqlDbType.

System.Data.SqlClient.SqlDbType is an enum and you can't use it with the
Import keyword.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#k**************@TK2MSFTNGP09.phx.gbl...
Hi,

I keep getting the same compiler error: 'Name 'SqlDbType' is not
declared' and I don't know why?

I've declared the following:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ import Namespace="System.Data." %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ import Namespace="System.Data.SqlDbType" %>

What am I missing?

Any help would be greatly appreciated!

Jerome



Nov 18 '05 #5
For this exact error try:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.Parse(datedebut.Text)

Or some other overload of the static Parse method, or the static ParseExact
method on the DateTime structure, depending on the input.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl...
Here's the line where the error comes:

cmdInsert.Parameters.Add( "@datedebut", SqlDbType.SmallDateTime
).Value=datedebut.Text )

Perhaps that'll help?

Jerome wrote:
Thanks Martin, but what could the reason be for that error message then?
Because even when removing the import keyword, it keeps getting displayed.
How do I declare that SqlDbType?

Thanks.
Martin Dechev wrote:
Jerome,

There is no namespace System.Data.SqlDbType.

System.Data.SqlClient.SqlDbType is an enum and you can't use it with the Import keyword.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#k**************@TK2MSFTNGP09.phx.gbl...

Hi,

I keep getting the same compiler error: 'Name 'SqlDbType' is not
declared' and I don't know why?

I've declared the following:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<%@ import Namespace="System.Data." %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ import Namespace="System.Data.SqlDbType" %>

What am I missing?

Any help would be greatly appreciated!

Jerome


Nov 18 '05 #6
Thanks Martin, but now I get the following:

Compiler Error Message: BC30456: 'SqlDbType' is not a member of 'SqlClient'.

I really don't quite get it because: cmdInsert.Parameters.Add(
"@datedebut", SqlDbType.SmallDateTime).Value=datedebut.Text is the
adaptation of an example from an asp.net book! They only difference is
in the example it was SqlDbType.Money that was used...

I'm trying to find out some more.

Martin Dechev wrote:
For this exact error try:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.Parse(datedebut.Text)

Or some other overload of the static Parse method, or the static ParseExact
method on the DateTime structure, depending on the input.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl...
Here's the line where the error comes:

cmdInsert.Parameters.Add( "@datedebut", SqlDbType.SmallDateTime
).Value=datedebut.Text )

Perhaps that'll help?

Jerome wrote:

Thanks Martin, but what could the reason be for that error message then?
Because even when removing the import keyword, it keeps getting
displayed.
How do I declare that SqlDbType?

Thanks.
Martin Dechev wrote:
Jerome,

There is no namespace System.Data.SqlDbType.

System.Data.SqlClient.SqlDbType is an enum and you can't use it with
the
Import keyword.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#k**************@TK2MSFTNGP09.phx.gbl.. .
>Hi,
>
>I keep getting the same compiler error: 'Name 'SqlDbType' is not
>declared' and I don't know why?
>
>I've declared the following:
>
><%@ Page Language="VB" ContentType="text/html"
>ResponseEncoding="iso-8859-1" %>
><%@ import Namespace="System.Data." %>
><%@ import Namespace="System.Data.Sqlclient" %>
><%@ import Namespace="System.Data.SqlDbType" %>
>
>What am I missing?
>
>Any help would be greatly appreciated!
>
>Jerome

Nov 18 '05 #7
Sorry, it was my mistake, SqlDbType is in fact in the System.Data namespace,
not in System.Data.SqlClient.

If datedebut.Text is "27/04/2004 15:30:00" the following should work:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.ParseExact(datedebut.Text, _
"dd/MM/yyyy HH:mm:ss", _
System.Globalization.DateTimeFormatInfo.InvariantI nfo)

Greetings
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:Oe**************@TK2MSFTNGP12.phx.gbl...
Thanks Martin, but now I get the following:

Compiler Error Message: BC30456: 'SqlDbType' is not a member of 'SqlClient'.
I really don't quite get it because: cmdInsert.Parameters.Add(
"@datedebut", SqlDbType.SmallDateTime).Value=datedebut.Text is the
adaptation of an example from an asp.net book! They only difference is
in the example it was SqlDbType.Money that was used...

I'm trying to find out some more.

Martin Dechev wrote:
For this exact error try:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.Parse(datedebut.Text)

Or some other overload of the static Parse method, or the static ParseExact method on the DateTime structure, depending on the input.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl...
Here's the line where the error comes:

cmdInsert.Parameters.Add( "@datedebut", SqlDbType.SmallDateTime
).Value=datedebut.Text )

Perhaps that'll help?

Jerome wrote:
Thanks Martin, but what could the reason be for that error message then?Because even when removing the import keyword, it keeps getting


displayed.
How do I declare that SqlDbType?

Thanks.
Martin Dechev wrote:
>Jerome,
>
>There is no namespace System.Data.SqlDbType.
>
>System.Data.SqlClient.SqlDbType is an enum and you can't use it with


the
>Import keyword.
>
>Hope this helps
>Martin
>"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
>news:#k**************@TK2MSFTNGP09.phx.gbl.. .
>
>
>>Hi,
>>
>>I keep getting the same compiler error: 'Name 'SqlDbType' is not
>>declared' and I don't know why?
>>
>>I've declared the following:
>>
>><%@ Page Language="VB" ContentType="text/html"
>>ResponseEncoding="iso-8859-1" %>
>><%@ import Namespace="System.Data." %>
>><%@ import Namespace="System.Data.Sqlclient" %>
>><%@ import Namespace="System.Data.SqlDbType" %>
>>
>>What am I missing?
>>
>>Any help would be greatly appreciated!
>>
>>Jerome
>
>
>


Nov 18 '05 #8

"Martin Dechev" <de*******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
Sorry, it was my mistake, SqlDbType is in fact in the System.Data namespace, not in System.Data.SqlClient.

If datedebut.Text is "27/04/2004 15:30:00" the following should work:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.ParseExact(datedebut.Text, _
"dd/MM/yyyy HH:mm:ss", _
System.Globalization.DateTimeFormatInfo.InvariantI nfo)
And I should stop copy-pasting wrong code....

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlDbType.SmallDateTime).Value = _
DateTime.ParseExact(datedebut.Text, _
"dd/MM/yyyy HH:mm:ss", _
System.Globalization.DateTimeFormatInfo.InvariantI nfo)

Greetings
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:Oe**************@TK2MSFTNGP12.phx.gbl...
Thanks Martin, but now I get the following:

Compiler Error Message: BC30456: 'SqlDbType' is not a member of

'SqlClient'.

I really don't quite get it because: cmdInsert.Parameters.Add(
"@datedebut", SqlDbType.SmallDateTime).Value=datedebut.Text is the
adaptation of an example from an asp.net book! They only difference is
in the example it was SqlDbType.Money that was used...

I'm trying to find out some more.

Martin Dechev wrote:
For this exact error try:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.Parse(datedebut.Text)

Or some other overload of the static Parse method, or the static ParseExact method on the DateTime structure, depending on the input.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl...

>Here's the line where the error comes:
>
>cmdInsert.Parameters.Add( "@datedebut", SqlDbType.SmallDateTime
>).Value=datedebut.Text )
>
>Perhaps that'll help?
>
>Jerome wrote:
>
>
>>Thanks Martin, but what could the reason be for that error message then?>>Because even when removing the import keyword, it keeps getting

displayed.

>>How do I declare that SqlDbType?
>>
>>Thanks.
>>
>>
>>Martin Dechev wrote:
>>
>>
>>>Jerome,
>>>
>>>There is no namespace System.Data.SqlDbType.
>>>
>>>System.Data.SqlClient.SqlDbType is an enum and you can't use it with

the

>>>Import keyword.
>>>
>>>Hope this helps
>>>Martin
>>>"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
>>>news:#k**************@TK2MSFTNGP09.phx.gbl.. .
>>>
>>>
>>>>Hi,
>>>>
>>>>I keep getting the same compiler error: 'Name 'SqlDbType' is not
>>>>declared' and I don't know why?
>>>>
>>>>I've declared the following:
>>>>
>>>><%@ Page Language="VB" ContentType="text/html"
>>>>ResponseEncoding="iso-8859-1" %>
>>>><%@ import Namespace="System.Data." %>
>>>><%@ import Namespace="System.Data.Sqlclient" %>
>>>><%@ import Namespace="System.Data.SqlDbType" %>
>>>>
>>>>What am I missing?
>>>>
>>>>Any help would be greatly appreciated!
>>>>
>>>>Jerome
>>>
>>>
>>>


Nov 18 '05 #9
Thanks, now it works!

Always these troubles with the dates ... ;)

Martin Dechev wrote:
"Martin Dechev" <de*******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP09.phx.gbl...
Sorry, it was my mistake, SqlDbType is in fact in the System.Data


namespace,
not in System.Data.SqlClient.

If datedebut.Text is "27/04/2004 15:30:00" the following should work:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.ParseExact(datedebut.Text, _
"dd/MM/yyyy HH:mm:ss", _
System.Globalization.DateTimeFormatInfo.InvariantI nfo)

And I should stop copy-pasting wrong code....

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlDbType.SmallDateTime).Value = _
DateTime.ParseExact(datedebut.Text, _
"dd/MM/yyyy HH:mm:ss", _
System.Globalization.DateTimeFormatInfo.InvariantI nfo)

Greetings
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:Oe**************@TK2MSFTNGP12.phx.gbl...
Thanks Martin, but now I get the following:

Compiler Error Message: BC30456: 'SqlDbType' is not a member of


'SqlClient'.
I really don't quite get it because: cmdInsert.Parameters.Add(
"@datedebut", SqlDbType.SmallDateTime).Value=datedebut.Text is the
adaptation of an example from an asp.net book! They only difference is
in the example it was SqlDbType.Money that was used...

I'm trying to find out some more.

Martin Dechev wrote:
For this exact error try:

cmdInsert.Parameters.Add( _
"@datedebut", _
System.Data.SqlClient.SqlDbType.SmallDateTime).Val ue = _
DateTime.Parse(datedebut.Text)

Or some other overload of the static Parse method, or the static


ParseExact
method on the DateTime structure, depending on the input.

Hope this helps
Martin
"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
news:#x**************@TK2MSFTNGP11.phx.gbl.. .
>Here's the line where the error comes:
>
>cmdInsert.Parameters.Add( "@datedebut", SqlDbType.SmallDateTime
>).Value=datedebut.Text )
>
>Perhaps that'll help?
>
>Jerome wrote:
>
>
>
>>Thanks Martin, but what could the reason be for that error message


then?
>>Because even when removing the import keyword, it keeps getting

displayed.
>>How do I declare that SqlDbType?
>>
>>Thanks.
>>
>>
>>Martin Dechev wrote:
>>
>>
>>
>>>Jerome,
>>>
>>>There is no namespace System.Data.SqlDbType.
>>>
>>>System.Data.SqlClient.SqlDbType is an enum and you can't use it with

the
>>>Import keyword.
>>>
>>>Hope this helps
>>>Martin
>>>"Jerome" <jh***@no.mnhn.spam.lu> wrote in message
>>>news:#k**************@TK2MSFTNGP09.phx.gbl. ..
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I keep getting the same compiler error: 'Name 'SqlDbType' is not
>>>>declared' and I don't know why?
>>>>
>>>>I've declared the following:
>>>>
>>>><%@ Page Language="VB" ContentType="text/html"
>>>>ResponseEncoding="iso-8859-1" %>
>>>><%@ import Namespace="System.Data." %>
>>>><%@ import Namespace="System.Data.Sqlclient" %>
>>>><%@ import Namespace="System.Data.SqlDbType" %>
>>>>
>>>>What am I missing?
>>>>
>>>>Any help would be greatly appreciated!
>>>>
>>>>Jerome
>>>
>>>
>>>

Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: studen77 | last post by:
Thanks to anyone in advance who can help :) Ok, I know this is a far stretch, but what I'm trying to do is to cast a System.object as one of the SqlDbType enumerations (SqlDbType.Int,...
4
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting...
5
by: Kevin R | last post by:
I'm trying to update a sql database. It's modified Oledb code from an example that did work with an access database. How can I tweak my code to make it work? Thanks in advance. Kevin...
1
by: Rob Richardson | last post by:
Greetings! I have a SQL Server stored procedure that takes one parameter, named @key. I am trying to run that stored procedure from a VB app. When I create a Parameter object and give it the...
2
by: John Kotuby | last post by:
Hi All, I am trying to move my experience with VB6 and ADO over to VB.NET. I am having difficulty with assigning values to SQL parameters. In classic ADO a value could be assigned to a parameter...
1
by: patrick | last post by:
I have tried using 2 type systems to get this to compile but it still gets the same error: Public MustInherit Class _Applications Private _AppID As System.Decimal Private _AppPosition As...
1
by: John Kotuby | last post by:
Hi all, I am working on porting an application from VB6 to VB.NET 2003 and am running into some problems. When declaring and populating the parameters for a SQL Stored Procedure by using the...
4
by: Chris Bordeman | last post by:
I have a DataColumn, want to derive the DbType. I can do column.GetType() but that's a system type, not a db type. How do I convert it to the corresponding type? Thanks much! Chris B.
2
markmcgookin
by: markmcgookin | last post by:
Hi Folks, I'm writing a VB app in .Net 2003, and I am getting a squiggley blue line error on mouse over (Yes that is a technical term) saying "SqlDbType is not declared" when I mouse over the...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.