15,904,023 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by om3n (Top 10 by date)
om3n
18-Sep-12 22:27pm
View
Thanks Mehdi Gholam, understood
om3n
18-Sep-12 2:41am
View
Thanks for your reply,
the problem is I have to do "distinct" the image columns. there is another way?
om3n
14-Sep-12 3:36am
View
thank you for quick reply, the problem can be solved :)
om3n
29-Aug-12 22:37pm
View
thanks for reply Ganesh Nikam :)
my issues are resolved
om3n
28-Aug-12 23:55pm
View
thanks Abhinav S,
understood, but I need enter NULL value not 0 either numeric or alphabetic,
I tried directly to sql server database, there is can accept null values
om3n
28-Aug-12 23:39pm
View
thanks all,
I've tried :
Dim Col2 As Nullable(Of Integer)
OpenDatabase()
Command.Connection = Con
Command.CommandType = CommandType.Text
Command.CommandText = "INSERT INTO SIGN(TYPESIGN_ID) VALUES('" + Col2 + "')"
Command.ExecuteNonQuery()
Con.Close()
Still can't, I get error "Conversion from string"')" to type 'Double' is not valid."
if using :
"INSERT INTO SIGN(TYPESIGN_ID) VALUES(" + "null" + ")"
the result is successfully.
however, what if insert null values using variables?
om3n
28-Aug-12 23:14pm
View
I've tried as you say:
Command.CommandText = "INSERT INTO SIGN(TYPESIGN_ID) VALUES('" + Col2 + "')"
I get error "Conversion from string"')" to type 'Double' is not valid."
I'm also try :
Command.CommandText = "INSERT INTO SIGN(TYPESIGN_ID) VALUES('" + Col2.ToString + "')"
Also get error "The INSERT statement conflicted with the FOREIGN KEY constraint "FK_SIGN_TYPE_SIGN". The conflict occurred in database "database", table "dbo.TYPE_SIGN", coloumn 'TYPESIGN_ID'. The statement has been terminated."
if using Col2.ToString the value is 0
om3n
31-Jul-12 0:44am
View
Thank you so much Trak4Net, the problem can be solved. you're a genius. I was motivated to study even harder
om3n
30-Jul-12 3:47am
View
Error message :
"AccessViolationException was unhandled"
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Inventory.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
om3n
30-Jul-12 3:45am
View
Thanks Trak4net,
As you say, The following is the complete code that I have tried :
==========================
Connection Module
==========================
Imports System.Data
Imports System.Data.SqlClient
Module Connection
Public ConStrInv As String
Public ConStrAuct As String
Public ConInv As New SqlConnection
Public ConAuct As New SqlConnection
Public CommandInv As New SqlCommand
Public CommandAuct As New SqlCommand
Public ObjDtAdapterInv As New SqlDataAdapter
Public ObjDtAdapterAuct As New SqlDataAdapter
Public objDataSetInv As New DataSet
Public objDataSetAuct As New DataSet
Public Sub OpenInventory()
ConStrInv = "Server=h04mc3kn;Database=inventory;user id=sa;password=123;"
ConInv.ConnectionString = ConStrInv
Try
If ConInv.State <> ConnectionState.Closed Then
ConInv.Close()
ConInv.Open()
Else
ConInv.Open()
End If
Catch ex As Exception
MsgBox("Sorry Can not open connection ! ")
End Try
End Sub
Public Sub OpenAuction()
ConStrAuct = "Server=h04mc3kn;Database=auction;user id=sa;password=123;"
ConAuct.ConnectionString = ConStrAuct
Try
If ConAuct.State <> ConnectionState.Closed Then
ConAuct.Close()
ConAuct.Open()
Else
ConAuct.Open()
End If
Catch ex As Exception
MsgBox("Sorry Can not open connection ! ")
End Try
End Sub
End Module
============
Form
============
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Private Sub TBArtist_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBArtist.TextChanged
Call OpenInventory()
CommandInv.Connection = ConInv
CommandInv.CommandType = CommandType.Text
CommandInv.CommandText = "SELECT ART_NAME FROM ARTIST"
ObjDtAdapterInv.SelectCommand = CommandInv
ObjDtAdapterInv.Fill(objDataSetInv, "Artist")
ObjDtAdapterInv.Dispose()
Dim col As New AutoCompleteStringCollection
Dim i As Integer
For i = 0 To objDataSetInv.Tables("Artist").Rows.Count - 1
col.Add(objDataSetInv.Tables("Artist").Rows(i)("ART_NAME").ToString())
Next
TBArtist.AutoCompleteSource = AutoCompleteSource.CustomSource
TBArtist.AutoCompleteCustomSource = col
TBArtist.AutoCompleteMode = AutoCompleteMode.Suggest
CommandInv.Dispose()
ObjDtAdapterInv.Dispose()
ConInv.Close()
End Sub
Private Sub TBOwner_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBOwner.TextChanged
Call OpenAuction()
CommandAuct.Connection = ConAuct
CommandAuct.CommandType = CommandType.Text
CommandAuct.CommandText = "SELECT cli_firstname FROM tclient WHERE cli_firstname LIKE '%" & TBOwner.Text & "%'"
ObjDtAdapterAuct.SelectCommand = CommandAuct
ObjDtAdapterAuct.Fill(objDataSetAuct, "Owner")
Dim ColOwner As New AutoCompleteStringCollection
Dim i As Integer
For i = 0 To objDataSetAuct.Tables("Owner").Rows.Count - 1
ColOwner.Add(objDataSetAuct.Tables("Owner").Rows(i)("cli_firstname").ToString())
Next
TBOwner.AutoCompleteSource = AutoCompleteSource.CustomSource
TBOwner.AutoCompleteCustomSource = ColOwner
TBOwner.AutoCompleteMode = AutoCompleteMode.Suggest
CommandAuct.Dispose()
ObjDtAdapterAuct.Dispose()
ConAuct.Close()
End Sub
End Class
First step, I typed in the TBArtist, a result I managed to get the Artist's data after that I typed again in the TBOwner. when I enter the first character of the word "MR" there is no error message, when I enter the second character is "R" I get the error message :
"AccessViolationException was unhandled"
Attempted to read or write
Show More