Solved

OleDbDataAdapter and OleDbType.LongVarWChar

Posted on 2016-08-26
4
42 Views
Last Modified: 2016-08-29
What do I specify for the length when I use OleDbType.LongVarWChar as the datatype?

  OleAdp.InsertCommand.Parameters.Add("@customer_desc", OleDbType.LongVarWChar, ???, "customer_desc")
0
Comment
Question by:HLRosenberger
  • 3
4 Comments
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41771773
Same question for OleDbType.Date.
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 41771825
Same question for OleDbType.Boolean
0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 500 total points
ID: 41772691
https://msdn.microsoft.com/en-us/library/xy9dbyk1(v=vs.110).aspx

Remarks
The Size is inferred from the value of the dataType parameter if it is not explicitly set in the size parameter.

so for fields that have defined sizes such as Date, Boolean etc, no length is required.

    Dim parameter As New OleDbParameter("Description", OleDbType.VarChar, 88)
    parameter.Direction = ParameterDirection.Output

the example shows for a varchar, the length should match the field length or the max size you will allow to be saved to the database.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41774615
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now