User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 375,201 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,254 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 636 | Replies: 1 | Solved
Reply
Join Date: Jun 2007
Posts: 49
Reputation: Mr.Wobbles is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Mr.Wobbles Mr.Wobbles is offline Offline
Light Poster

MS SQL insertion via VB (Query question)

  #1  
Apr 25th, 2008
I am trying to insert tables into a database that I created at runtime, I am using MS SQL Server Express, and I have tested this query and it works, in the sense that a table is created. However the small text field (stringText [char]) only has a length of 1, that is not very useful... When I try to specify a length i.e. varchar(MAX) or varchar(255) or any other value really it gives me an error that Column, parameter, or variable #2: Cannot find data type varchar(255).

I have set up a msg box to show the SQL that I generate whenever I run the program. It is as follows:
---------------------------
Portfolio Generator 3.0
---------------------------
Inserting into Database: 
BEGIN TRANSACTION CREATE TABLE [dbo].[testTable] ( [testTableID] [int] NOT NULL PRIMARY KEY, stringText [char] NULL DEFAULT (''), largeText [text] NULL DEFAULT (''), integerVal [int] NULL DEFAULT ((0)), doubleVal [int] NULL DEFAULT ((0)), dateVal [datetime] NULL DEFAULT (04/25/2008), boolVal [tinyint] NULL DEFAULT ((0))) COMMIT

Any questions about something I may have left out will be happily answered, and any help that is given, thank you in advance.
Mr.Wobbles~
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: MS SQL insertion via VB (Query question)

  #2  
May 9th, 2008
get rid of the square brackets around the varchar(255) and it will work fine.

For that matter, why are you putting them around the datatypes anyway? I've never seen anyone do that.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 2:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC