Community of MapPoint and Bing Maps Users and Developers
This is a discussion on problem in vb code... within the MapPoint Desktop Discussion forums, part of the Map Forums category; will u please check it out this code n try to hep me ...out .. error occurred is : ":Column ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| problem in vb code... error occurred is : ":Column name or number of supplied values does not match table definition." Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b1.Click Dim con_str As String = "Data Source=.\SQLEXPRESS;Initial Catalog=mydatabase;Integrated Security=True;Pooling=False" Dim cn As New SqlConnection(con_str) Dim cmd As New SqlCommand() cmd.CommandText = "select * from tabreg " cmd.Connection = cn Dim dd As New SqlDataAdapter(cmd) Dim dst As New DataSet() dd.Fill(dst, "first") Dim dt As DataTable = dst.Tables("first") Dim n As Integer = dt.Rows.Count Dim p As Integer = 1001 If n > 0 Then Dim z As Integer For z = 0 To n - 1 Dim dr As DataRow = dt.Rows(z) p = dr("regno") Next p = p + 1 End If cmd = New SqlCommand() cmd.CommandText = "insert into tabreg values(@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13, @14,@15,@16,@17,@18,@19,@20,@21,@22,@23,@24,@25,@2 6,@27,@28,@29,@30,@31,@32,@33,@34,@35,@36,@37)" cmd.Connection = cn cmd.Parameters.AddWithValue("@1", p) cmd.Parameters.AddWithValue("@2", t1.Text) cmd.Parameters.AddWithValue("@3", t2.Text) cmd.Parameters.AddWithValue("@4", t3.Text) cmd.Parameters.AddWithValue("@5", t4.Text) cmd.Parameters.AddWithValue("@6", t5.Text) Dim g As String = "male" If (r2.Checked) Then g = "female" End If cmd.Parameters.AddWithValue("@7", g) cmd.Parameters.AddWithValue("@8", Val(t6.Text)) Dim h As String = "married" If (r4.Checked) Then h = "unmarried" End If cmd.Parameters.AddWithValue("@9", h) Dim nation As String = "" nation = nation & c1.SelectedValue cmd.Parameters.AddWithValue("@10", nation) Dim MinDate As Date Dim dob As Date MinDate = CDate("1.1.1980") dob = CDate(mt1.Text) ' Check that dob is between MinDate and Now() If MinDate <= dob AndAlso dob <= System.DateTime.Now Then ' Dob is valid Else ' Dob is outside date bounds End If cmd.Parameters.AddWithValue("@11", dob) Dim i As String = "ST" If (r6.Checked) Then i = "SC" End If If (r7.Checked) Then i = "OBC" End If If (r8.Checked) Then i = "GEN" End If cmd.Parameters.AddWithValue("@12", i) cmd.Parameters.AddWithValue("@13", t7.Text) cmd.Parameters.AddWithValue("@14", t8.Text) cmd.Parameters.AddWithValue("@15", t9.Text) Dim hint As String = "" hint = hint & c2.SelectedValue cmd.Parameters.AddWithValue("@16", hint) cmd.Parameters.AddWithValue("@17", t11.Text) cmd.Parameters.AddWithValue("@18", t12.Text) cmd.Parameters.AddWithValue("@19", t13.Text) cmd.Parameters.AddWithValue("@20", mt2.Text) cmd.Parameters.AddWithValue("@21", t14.Text) cmd.Parameters.AddWithValue("@22", t15.Text) cmd.Parameters.AddWithValue("@23", t16.Text) cmd.Parameters.AddWithValue("@24", t17.Text) cmd.Parameters.AddWithValue("@25", mt3.Text) Dim nation_p As String = "" nation_p = nation_p & c3.SelectedValue cmd.Parameters.AddWithValue("@26", nation_p) cmd.Parameters.AddWithValue("@27", t18.Text) cmd.Parameters.AddWithValue("@28", t19.Text) cmd.Parameters.AddWithValue("@29", t20.Text) cmd.Parameters.AddWithValue("@30", mt4.Text) Dim nation_t As String = "" nation_t = nation_t & c4.SelectedValue cmd.Parameters.AddWithValue("@31", nation_t) cmd.Parameters.AddWithValue("@32", rt1.Text) cmd.Parameters.AddWithValue("@33", rt2.Text) cmd.Parameters.AddWithValue("@34", Val(t21.Text)) cmd.Parameters.AddWithValue("@35", Val(t22.Text)) cmd.Parameters.AddWithValue("@36", Val(t23.Text)) cmd.Parameters.AddWithValue("@37", rt3.Text) dd = New SqlDataAdapter(cmd) dst = New DataSet() dd.Fill(dst) MessageBox.Show("ur id is " & p.ToString) End Sub m waiting for ur help ![]() |
| |||
| Re: problem in vb code...
Hi, Please start by stepping with your debugger. Then you can localize the offending line of code. Then if it has something to do with mappoint you can post again.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: problem in vb code...
There seems to be a rash of newbie programmers with Indian-sounding names asking for basic help lately. Is there a way to make that sound less politically correct? Eric
__________________ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ![]() Contribute and Learn at our New MapPoint and Virtual Earth Wiki - http://www.MapElves.com . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ![]() |
| |||
| Re: problem in vb code...
Don't you mean "Is there a way to make that sound less politically INcorrect?" ? It's probably just my cynical mind but I'd suspect a major project has been outsourced and the new team is learning on the job. No doubt promises were made about experience but the client was really only interested in the price. |
| |||
| Re: problem in vb code...
Hi, No problem, but it is really impossible to read and debug a couple of hunderds line of code. That's up to you. Try to trace down the problem to the offending line, then simplify the code eventally and post again here. Lots of people will try to help here but everyone has his own job and much to do. I't like a marriage, effort must come from both ends
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz www.comfortsoftware.be MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| code, problem |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to map zip code and postal code to mappoint | Boon | MapPoint Desktop Discussion | 3 | 09-22-2009 05:39 PM |
| Mapping Areas based on Postal Code / Zip Code? | toncm1 | General Chat | 4 | 05-30-2009 06:43 PM |
| Using zip code data, suppressing zip code labels? | Santa Monica Realtor | MapPoint Desktop Discussion | 3 | 02-25-2009 10:54 AM |
| code problem | mmartin | MapPoint Desktop Discussion | 1 | 04-10-2007 07:55 AM |
| Zip Code Problem | Anonymous | MapPoint Desktop Discussion | 1 | 12-07-2003 10:50 PM |