|
hi,
hi i have to checkboxes in my form which are associated to two columns of table of bit value type... default they have null value..
for the select query i used isnull(col_val,0) as <alias name=""> for both columns to check the null values & replace with null
but when i save my record through adapter.update() the value not get saved into database...
what's the problem..
need help
|
|
|
|
|
It used to be that bit values could not be null depending on your database or connection this may be the case. Bit = boolean eg 1 or 0
I beleive this has changed in later versions of SQL Server but I may be wrong. If you need a 3 valued field ie Null, 0 , 1 use an interger. and use -1,0,1
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i need to check against null value if not then assign 0 or 1..
i am using sql server 2005
|
|
|
|
|
ok post your select statement becuase IsNull is the correct function to deal with this issue.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ok here is the query....
for all values i clear the bind first then bind them thru appropriate columns... i debug all values agre going to dataget..just after adapter.update(dataset) ..value doesn't updated to database..
"select pra_key,ClientAddCode,Name,Address1,Address2,City,Country,Pin,ResTel,ResFax," & _
"ResEmail,OffTel,OffFax,OffEmail,OffExtn,Mobile,ITPAN,RegDate,isnull(IsError,0) as IsError,isnull(IsBlock,0) as IsBlock,isnull(ParentCode,'') as ParentCode,ResidentialStatus,offadd1,offadd2," & _
"offaddcountry,offaddpincode,dob,occupation," & _
"educationalqlfy, offaddcity,clientcategorycode,SubBranchCode,PoAMandate," & _
"WebXCode,FASubTypeCode,UINo,agmtsrno,state,clnttype,intfirstname,intmiddlename,intlastname," & _
"relationshipwithclient,intclientcode,offaddstate,internettrading,directclient,RMCode,SubGroupCode,poadate," & _
"bankcertificate,employeecode,contactperson,paymentprocessing,creditlimit," & _
"creditlimitamount,paymentmethod, ucccategory,ioischarges,ioholdcharges, " & _
"digitalcontracts, frontofficeupload, internettradingupload, frontofficedealer, deactivate, " & _
"deactivationdate, paymenthold, interesttype, interestjv, paymenttype, runningaccountletter, " & _
"rmsgroup, region, clientcashtosharesratio from clientaddmaster where clientaddcode=@clientaddcode"
|
|
|
|
|
This is what I would do:
1. Open SQL profiler to determine *exactly* what SQL statement is being sent to the database. If needed, you can pause the recording and turn it on just prior to running your update.
2. Open up SQL Management Studio. Copy and paste the update statement from profiler.
3. Execute the statement. Determine what part of the statement is hosed and fix it.
4. Go back to VB and correct the code to match the working statement in step 3.
Profiler will show you exactly what is being sent to and from the databases - versus you think is being sent.
|
|
|
|
|
So presumably you are building a sql string and using that in the adapter.update. Your error is fairly obvious, if you are using SQL management studio you should actually open sql profiler and look at the string that is passed to sql server.
Copy the string from the debug immediate or command window and paste it into SQL query tool and see what you get.
Hint - you must do all the data manipulation BEFORE it gets into the string, IsNull is a SQL function and you are passing it in as a string.
Suggestion - strong one, get to know stored procedures or at least parameterised queries thay will save you a lot of heartache in the future.
Actually I have no idea what would be going through as I NEVER use the adapter select/update methods.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Hint - you must do all the data manipulation BEFORE it gets into the string, IsNull is a SQL function and you are passing it in as a string.
Suggestion - strong one, get to know stored procedures or at least parameterised queries thay will save you a lot of heartache in the future.
Amen!
Stored procedures are the way to go and really are not that hard to put together. Read a couple SP guides/tutorials and you'll be on your way.
|
|
|
|
|
I would like to hide the GUI in access. I have created a database, replaced access splash screen, but I want to prevent the access GUI from showing. How is that done? In other words, I want only the forms that I have created to be visible. The entire MS access GUI should be hidden including the menu bar. How is that done?
Jesus Christ is Lord - Give your heart to Him now.
|
|
|
|
|
What does this have to do with VB.NET? Are you talking about Access forms or Winforms?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I'd like to shoot the GUI in Access, as a matter of fact I'd like to shoot Access.
It is certainly possible to limit the ui to your forms and controls (used to be) but I can't remember how. I think it was a combination of disabling options and making object visible=false.
Can you still compile Access to an MDE.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Open up the database and go to Startup on the Tools menu, then uncheck the "Show Database Window" option. You can also switch off the standard Access toolbars.
Pleae note that this is not especially secure - if the user holds down the shift key when starting up the database it shows the database window etc.
If you want to prevent this, look here for code to do it:
http://www.mvps.org/access/general/gen0040.htm[^]
====================================
Transvestites - Roberts in Disguise!
====================================
|
|
|
|
|
Hi all,
i need to calculate my paper length using a formula ( label_total_length.text = text_length.text *text_width.text), and after that enable to save the changes.
the query : Dim DimensionData As New SqlClient.SqlCommand(" UPDATE Dimension SET total_length = '"&label_total_length & " ')
but when the save button was clicked it show the syntax error : converting the varchar value '2,076 ' to a column of data type int.
at sql server i set the total_length data type as int
how i gonan fix the prob??
|
|
|
|
|
mistyfy wrote: label_total_length.text = text_length.text *text_width.text
You cannot do that. You have to convert the text to some numerical datatype, then do the math
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi Paul Conrad, may i have the detail on this?? some coding guide perhaps. thanks!
|
|
|
|
|
mistyfy wrote: may i have the detail on this?
Read up on type casting.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
mistyfy wrote: total_length = '"&label_total_length & " '
if total_length column is int, you cant use signle quotes. Single quotes are only used for varchar columns.
|
|
|
|
|
i tried to remove the single code but i stil got the error message that figure after the comma can't be save!!
|
|
|
|
|
Are you formating that numeric value? thats why the comma is there in the fist place right? Just reformat the value to remove the comma, or save the value in a variable before you formated that number.
|
|
|
|
|
'2,076' is a varchar data type 2076 is an integer - this is the frst issue
use convert or cast - read BOL for the details.
mistyfy wrote: SqlClient.SqlCommand(" UPDATE Dimension SET total_length = '"&label_total_length & " ')
SqlClient.SqlCommand(" UPDATE Dimension SET total_length = " + label_total_length.tostring())
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I created a few user controls. I created a separate class which contains a few data all these controls need
Public Class CExtraData
Private value1M As String
Private value2M As String
Public Property Value1() As String
Get
Return Me.value1M
End Get
Set(ByVal valueA As String)
Me.value1M = valueA
End Set
End Property
Public Property Value2() As String
Get
Return Me.value2M
End Get
Set(ByVal valueA As String)
Me.value2M = valueA
End Set
End Property
End Class
Every UserControl has an instance of a class as property such as
Private extraDataM As New CExtraData
Public Property ExtraData() As CExtraData
Get
Return Me.extraDataM
End Get
Set(ByVal valueA As CExtraData)
Me.extraDataM = valueA
End Set
End Property
If I use the UserControl in a form I would like to set the properties of the UserControl
... .ExtraData.Value1
... .ExtraData.Value2
by the designer. The property "ExtraData" shows in the property list of the designer but it is deactivated.
I tried following solutions:
+ Added "<serializable()>" in front of the definition of the class "CExtraData"
<serializable()> Public Class CExtraData
...
But it did not help.
+ Added Disigner-Attributes in front of the Property "ExtraData" in the UserControl:
< System.ComponentModel.Localizable(True), _
System.ComponentModel.DesignerSerializationVisibility( _
System.ComponentModel.DesignerSerializationVisibility.Content) > _
Public Property ExtraData() As CExtraData
...
But it did not help.
How can I solve it?
Michael
|
|
|
|
|
Maybee you kan change the extra info as a list(of object) that way you can add all kind of info you do not need another class and is easely accesebly
Jan
|
|
|
|
|
I got two solutions which both work properly. In the latter one you find a comparision of the two implementations
Michael
Version 1:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23661508.html
Version 2:
http://forums.msdn.microsoft.com/en-US/vbgeneral/thread/f3eaaee7-3b11-4a67-9f50-156020e66f1a
|
|
|
|
|
I am converting a VB6 app. The specific portion I am stuck on is reading a binary file and setting a bunch of fixed length variables (with nested loops, yadda yadda).
I'm getting some errors because I think the default value of the .Net fixed string is nothing, where as the fixed length strings in VB6 actually contain some form of value.
For example, take the following (from VB6):
BarNum2 As String * 2
If you add a watch, you can see the value is 2 square icons. The value is not "" or " ".
What I have in .Net:
<vbfixedstring(2),system.runtime.interopservices.marshalas(system.runtime.interopservices.unmanagedtype.byvalarray,sizeconst:>Public BarNum2() As Char
Looking at the default value in .Net is nothing.
How can I determine the character value of each square in vb6?
Odd question I know, but if any one can help, I'd appreciate it.
Thanks!
|
|
|
|
|
The defoult value is the lenght * chr(0). this is not a space but some char that is normely not used in text. the only place that I know it in some api/dll calls
Jan
hope this helps
if not try to debug.print all codes
For n As Integer = 0 To yourString.Length - 1
Debug.Print(CStr(Asc(yourString.Substring(n , 1))))
Next
and look at the values
|
|
|
|
|